LYGIA Shader Library

step (lygia/math/step)

this file contains the definition of the step function for float, float2, float3, and float4 types, to match GLSL's behavior.



<float> step(<float> a, <float> b);
<float2> step(<float2> a, <float2> b);
<float3> step(<float3> a, <float3> b);
<float4> step(<float4> a, <float4> b);
<float2> step(<float2> a, <float> b);
<float3> step(<float3> a, <float> b);
<float4> step(<float4> a, <float> b);

Check it on Github

#ifndef FNC_STEP
#define FNC_STEP

inline __host__ __device__ float step(float a, float b) { return (a > b)? 1.0f : 0.0f; }

inline __host__ __device__ float2 step(float2 a, float b) { return make_float2(step(a.x, b), step(a.y, b)); }
inline __host__ __device__ float3 step(float3 a, float b) { return make_float3(step(a.x, b), step(a.y, b), step(a.z, b)); }
inline __host__ __device__ float4 step(float4 a, float b) { return make_float4(step(a.x, b), step(a.y, b), step(a.z, b), step(a.w, b)); }

inline __host__ __device__ float2 step(float2 a, float2 b) { return make_float2(step(a.x, b.x), step(a.y, b.y)); }
inline __host__ __device__ float3 step(float3 a, float3 b) { return make_float3(step(a.x, b.x), step(a.y, b.y), step(a.z, b.z)); }
inline __host__ __device__ float4 step(float4 a, float4 b) { return make_float4(step(a.x, b.x), step(a.y, b.y), step(a.z, b.z), step(a.w, b.w)); }



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