linmath.h icon indicating copy to clipboard operation
linmath.h copied to clipboard

using mat4x4_scale as a MODEL uniform

Open ghost opened this issue 9 years ago • 2 comments

can there be a way to use mat4x4_scale to build a scale matrix with the w-component set to 1? that way we can just send it on up to the vertex shader as our scale matrix.

ghost avatar Jun 12 '15 07:06 ghost

Well, not mat4x4_scale itself, because that would change its semantics. For a quick ad-hoc solution I suggest using mat4x4_scale_aniso (which keeps the w column as is) with the three scaling factors being equal. E.g.

mat4x4 M;
mat4x4_identity(M);
mat4x4_scale_aniso(M, M, s, s, s);

datenwolf avatar Jun 12 '15 08:06 datenwolf

mat…_scale (and vec…_scale for that matter) are defined in terms of multiplication with a scalar value and not so much a scaling in the geometrical sense, although for vectors there's no difference.

datenwolf avatar Jun 12 '15 08:06 datenwolf