lygia
/draw
/matrix
)Draws all the digits of a matrix, useful for debugging.
Dependencies:
Use:
<vec4> matrix(<vec2> st, <mat2|mat3|mat4> M)
#ifndef FNC_DRAW_MATRIX
#define FNC_DRAW_MATRIX
vec4 matrix(in vec2 st, in mat2 M) {
vec4 rta = vec4(0.0);
vec2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 2.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
vec4 matrix(in vec2 st, in mat3 M) {
vec4 rta = vec4(0.0);
vec2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 3.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
vec4 matrix(in vec2 st, in mat4 M) {
vec4 rta = vec4(0.0);
vec2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 4.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
#endif
Dependencies:
Use:
<float4> matrix(<float2> st, <float2x2|float3x3|float4x4> M)
#ifndef FNC_DRAW_MATRIX
#define FNC_DRAW_MATRIX
float4 matrix(in float2 st, in float2x2 M) {
float4 rta = float4(0.0, 0.0, 0.0, 0.0);
float2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 2.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
float4 matrix(in float2 st, in float3x3 M) {
float4 rta = float4(0.0, 0.0, 0.0, 0.0);
float2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 3.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
float4 matrix(in float2 st, in float4x4 M) {
float4 rta = float4(0.0, 0.0, 0.0, 0.0);
float2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 4.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
#endif
Dependencies:
Use:
<float4> matrix(<float2> st, <float2x2|float3x3|float4x4> M)
#ifndef FNC_DRAW_MATRIX
#define FNC_DRAW_MATRIX
float4 matrix(in float2 st, in float2x2 M) {
float4 rta = float4(0.0, 0.0, 0.0, 0.0);
float2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 2.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
float4 matrix(in float2 st, in float3x3 M) {
float4 rta = float4(0.0, 0.0, 0.0, 0.0);
float2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 3.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
float4 matrix(in float2 st, in float4x4 M) {
float4 rta = float4(0.0, 0.0, 0.0, 0.0);
float2 size = DIGITS_SIZE * abs(DIGITS_VALUE_OFFSET) * 4.0;
rta.a = 0.5 * step(-DIGITS_SIZE.x, st.x) * step(st.x, size.x) * step(-DIGITS_SIZE.y, st.y) * step(st.y, size.y);
rta += digits(st, M);
return rta;
}
#endif
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