Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use glm_{vec2,vec3,vec4} to fill vector by individual items #329

Open
EasyIP2023 opened this issue Jul 9, 2023 · 1 comment
Open

Use glm_{vec2,vec3,vec4} to fill vector by individual items #329

EasyIP2023 opened this issue Jul 9, 2023 · 1 comment

Comments

@EasyIP2023
Copy link
Contributor

EasyIP2023 commented Jul 9, 2023

Multiple PR's are merge to allow creating matrices and vectors given a pointer to an array of floats. All suffixed with name _make

  • glm_vec2_make
  • glm_vec3_make
  • glm_vec4_make
  • glm_mat2_make
  • glm_mat3_make
  • glm_mat4_make
    Later PR's
  • glm_mat2x3_make
  • glm_mat2x4_make
  • glm_mat3x2_make
  • glm_mat3x4_make
  • glm_mat4x2_make
  • glm_mat4x3_make

Full set

// Matrix 2x2, 2x3, 2x4
glm_vec2_make(float * __restrict src, vec2 dest);
glm_mat2_make(float * __restrict src, mat2 dest);
glm_mat2x3_make(float * __restrict src, mat2x3 dest);
glm_mat2x4_make(float * __restrict src, mat2x4 dest);

// Matrix 3x2, 3x3, 3x4
glm_vec3_make(float * __restrict src, vec3 dest);
glm_mat3x2_make(float * __restrict src, mat3x2 dest);
glm_mat3_make(float * __restrict src, mat3 dest);
glm_mat3x4_make(float * __restrict src, mat3x4 dest);

// Matrix 4x2, 4x3, 4x4
glm_vec4_make(float * __restrict src, vec4 dest);
glm_mat4x2_make(float * __restrict src, mat4x2 dest);
glm_mat4x3_make(float * __restrict src, mat4x3 dest);
glm_mat4_make(float * __restrict src, mat4 dest);

However one function glm_vec2 does exactly that.
Issue created to discuss if we should utilize functions
with no _make suffix to fill in vector by individual items.

glm_vec2(x, y, dest);
glm_vec3(x, y, z, dest);
glm_vec4(x, y, z, w, dest);
@recp
Copy link
Owner

recp commented Jul 11, 2023

Hi @EasyIP2023,

I like the proposal but let wait a little bit to get more feedbacks,

Currently glm_vec3() creates vec3 from vec4 or pointer, glm_vec2() creates vec2 from pointer. glm_vec4(vec3, 1.0, dest) promotes vec3 to vec4 by adding last element.

We must DEPRECATE these or select alternative names for:

glm_vec2(x, y, dest);
glm_vec3(x, y, z, dest);
glm_vec4(x, y, z, w, dest);

e.g.

glm_vec2_from(x, y, dest);
glm_vec3_from(x, y, z, dest);
glm_vec4_from(x, y, z, w, dest);
glm_vec2_makes(x, y, dest);
glm_vec3_make_s(x, y, z, dest);
glm_vec4_make_s(x, y, z, w, dest);
glm_vec2_init(x, y, dest);
glm_vec3_init(x, y, z, dest);
glm_vec4_init(x, y, z, w, dest);

or any better names ... if we chose this direction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants