mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
fix scale_as for zero length vector
* return zero if vector length is zero
This commit is contained in:
@@ -247,8 +247,8 @@ glm_vec_scale_as(vec3 v, float s, vec3 dest) {
|
|||||||
float norm;
|
float norm;
|
||||||
norm = glm_vec_norm(v);
|
norm = glm_vec_norm(v);
|
||||||
|
|
||||||
if (norm == 0) {
|
if (norm == 0.0f) {
|
||||||
glm_vec_copy(v, dest);
|
glm_vec_zero(dest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ glm_vec4_scale_as(vec4 v, float s, vec4 dest) {
|
|||||||
float norm;
|
float norm;
|
||||||
norm = glm_vec4_norm(v);
|
norm = glm_vec4_norm(v);
|
||||||
|
|
||||||
if (norm == 0) {
|
if (norm == 0.0f) {
|
||||||
glm_vec4_copy(v, dest);
|
glm_vec4_zero(dest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user