lygia
/space
/translate
)Add a translation component to a transform matrix
Use:
<mat4> translate(in <mat3> matrix, in <vec3> tranaslation)
#ifndef FNC_TRANSLATE
#define FNC_TRANSLATE
mat4 translate(mat3 m, vec3 translation) {
return mat4(
vec4(m[0], 0.0),
vec4(m[1], 0.0),
vec4(m[2], 0.0),
vec4(translation, 1.0)
);
}
#endif
Use:
<float4x4> translate(in <float3x3> matrix, in <float3> tranaslation)
#ifndef FNC_TRANSLATE
#define FNC_TRANSLATE
float4x4 translate(float3x3 m, float3 translation) {
return float4x4(
float4(m._m00_m01_m02, translation.x),
float4(m._m10_m11_m12, translation.y),
float4(m._m20_m21_m22, translation.z),
float4(0.0, 0.0, 0.0, 1.0));
}
#endif
MIT License (MIT) Copyright (c) 2024 Shadi EL Hajj
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository