LYGIA Shader Library

uncenter (lygia/space/uncenter)

Moves the center from 0.0 to 0.5

Use:

<float|vec2|vec3> uncenter(<float|vec2|vec3> st)

Check it on Github


#ifndef FNC_UNCENTER
#define FNC_UNCENTER

float uncenter(float v) { return v * 0.5 + 0.5; }
vec2  uncenter(vec2 v) { return v * 0.5 + 0.5; }
vec3  uncenter(vec3 v) { return v * 0.5 + 0.5; }

#endif

Use:

<float|float2|float3> uncenter(<float|float2|float3> st)

Check it on Github


#ifndef FNC_UNCENTER
#define FNC_UNCENTER

float  uncenter(float x) { return x * 0.5 + 0.5; }
float2 uncenter(float2 st) { return st * 0.5 + 0.5; }
float3 uncenter(float3 pos) { return pos * 0.5 + 0.5; }

#endif

Examples

License

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