Skip to content

glm_vec4_smoothstep #1222

Closed
Closed
@gottfriedleibniz

Description

@gottfriedleibniz

glm_vec4_smoothstep incorrectly computes 't'. Per GLSL:

genFType t;
t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);

Stepping through the function

glm_vec4 const sub0 = glm_vec4_sub(x, edge0);      // (x - edge0)
glm_vec4 const sub1 = glm_vec4_sub(edge1, edge0);  // (edge1 - edge0)
glm_vec4 const div0 = glm_vec4_sub(sub0, sub1);    // (x - edge0) - (edge1 - edge0); should be divide
glm_vec4 const clp0 = glm_vec4_clamp(div0, _mm_setzero_ps(), _mm_set1_ps(1.0f));
/// ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions