LYGIA Shader Library

windmillTile (lygia/space/windmillTile)

Rotate tiles (in a squared grid pattern) by 45 degrees

Dependencies:

Use:

<vec4> windmillTile(<vec4> tiles[, <float> fullturn = TAU])
<vec2> windmillTile(<vec2> st [, <float|vec2> scale])

Check it on Github



#ifndef FNC_WINDMILLTILE
#define FNC_WINDMILLTILE
vec4 windmillTile(vec4 t, float turn) {
    float a = ( abs(mod(t.z, 2.0)-
                    mod(t.w, 2.0))+
                mod(t.w, 2.0) * 2.0)*
                0.25;
    return vec4(rotate(t.xy, a * turn), t.zw);
}

vec4 windmillTile(vec4 t) {
    return windmillTile(t, TAU);
}

vec4 windmillTile(vec2 v) {
    return windmillTile(sqTile(v));
}

vec4 windmillTile(vec2 v, float s) {
    return windmillTile(v * s);
}

vec4 windmillTile(vec2 v, vec2 s) {
    return windmillTile(v * s);
}
#endif

Dependencies:

Use:

<float4> windmillTile(<float4> tiles[, <float> fullturn = TAU])
<float2> windmillTile(<float2> st [, <float|float2> scale])

Check it on Github



#ifndef FNC_WINDMILLTILE
#define FNC_WINDMILLTILE
float4 windmillTile(float4 tile, float turn) {
    float a = ( abs(mod(tile.z, 2.0)-
                    mod(tile.w, 2.0))+
                mod(tile.w, 2.0) * 2.0)*
                0.25;
    return float4(rotate(tile.xy, a * turn), tile.zw);
}

float4 windmillTile(float4 tile) {
    return windmillTile(tile, TAU);
}

float4 windmillTile(float2 st) {
    return windmillTile(sqTile(st));
}

float4 windmillTile(float2 st, float scale) {
    return windmillTile(st * scale);
}

float4 windmillTile(float2 st, float2 scale) {
    return windmillTile(st * scale);
}
#endif

Dependencies:

Use:

<float4> windmillTile(<float4> tiles[, <float> fullturn = TAU])
<float2> windmillTile(<float2> st [, <float|float2> scale])

Check it on Github



#ifndef FNC_WINDMILLTILE
#define FNC_WINDMILLTILE
float4 windmillTile(float4 t, float turn) {
    float a = ( abs(mod(t.z, 2.0)-
                    mod(t.w, 2.0))+
                mod(t.w, 2.0) * 2.0)*
                0.25;
    return float4(rotate(t.xy, a * turn), t.zw);
}

float4 windmillTile(float4 t) {
    return windmillTile(t, TAU);
}

float4 windmillTile(float2 v) {
    return windmillTile(sqTile(v));
}

float4 windmillTile(float2 v, float s) {
    return windmillTile(v * s);
}

float4 windmillTile(float2 v, float2 s) {
    return windmillTile(v * s);
}
#endif

Examples

Licenses

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.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository