fuckingtech/public/assets/glsl/lygia/math/select.msl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

17 lines
No EOL
888 B
Text

/*
contributors: Patricio Gonzalez Vivo
description: "Returns A when cond is true, and B otherwise. This is part to bring a compatibility layer with WGSL \n"
use: <float|float2|float3|float4> select(<float|float2|float3|float4> A, <float|float2|float3|float4> B, <bool> cond)
license:
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
*/
#ifndef FNC_SELECT
#define FNC_SELECT
int select(int A, int B, bool cond) { return cond ? A : B; }
float select(float A, float B, bool cond) { return cond ? A : B; }
float2 select(float2 A, float2 B, bool cond) { return cond ? A : B; }
float3 select(float3 A, float3 B, bool cond) { return cond ? A : B; }
float4 select(float4 A, float4 B, bool cond) { return cond ? A : B; }
#endif