lygia
/math
/saturateMediump
)clamp a value between 0 and the medium precision max (65504.0) for floating points
Use:
<float|vec2|vec3|vec4> saturateMediump(<float|vec2|vec3|vec4> value)
#ifndef FNC_SATURATEMEDIUMP
#define FNC_SATURATEMEDIUMP
#ifndef MEDIUMP_FLT_MAX
#define MEDIUMP_FLT_MAX 65504.0
#endif
#if defined(TARGET_MOBILE) || defined(PLATFORM_WEBGL) || defined(PLATFORM_RPI)
#define saturateMediump(V) min(V, MEDIUMP_FLT_MAX)
#else
#define saturateMediump(V) V
#endif
#endif
Use:
<float|float2|float3|float4> saturateMediump(<float|float2|float3|float4> value)
#ifndef FNC_SATURATEMEDIUMP
#define FNC_SATURATEMEDIUMP
#ifndef MEDIUMP_FLT_MAX
#define MEDIUMP_FLT_MAX 65504.0
#endif
#if defined(TARGET_MOBILE) || defined(PLATFORM_WEBGL) || defined(PLATFORM_RPI)
#define saturateMediump(x) min(x, MEDIUMP_FLT_MAX)
#else
#define saturateMediump(x) x
#endif
#endif
Use:
<float|float2|float3|float4> saturateMediump(<float|float2|float3|float4> value)
#ifndef FNC_SATURATEMEDIUMP
#define FNC_SATURATEMEDIUMP
#ifndef MEDIUMP_FLT_MAX
#define MEDIUMP_FLT_MAX 65504.0
#endif
#if defined(TARGET_MOBILE) || defined(PLATFORM_WEBGL) || defined(PLATFORM_RPI)
#define saturateMediump(V) min(V, MEDIUMP_FLT_MAX)
#else
#define saturateMediump(V) V
#endif
#endif
Dependencies:
Use:
<float|vec2|vec3|vec4> saturateMediump(<float|vec2|vec3|vec4> value)
#ifndef FNC_SATURATEMEDIUMP
#define FNC_SATURATEMEDIUMP
#ifndef MEDIUMP_FLT_MAX
#define MEDIUMP_FLT_MAX 65504.0
#endif
#if defined(TARGET_MOBILE) || defined(PLATFORM_WEBGL) || defined(PLATFORM_RPI)
#define saturateMediump(x) min(x, MEDIUMP_FLT_MAX)
#else
#define saturateMediump(x) x
#endif
#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