select
Returns t if cond is true, and f otherwise.
Component-wise if cond is a vector.
Example
Section titled “Example”select(1, 2, false) // returns 1select(1, 2, true) // returns 2select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)Call Signature
Section titled “Call Signature”select<
T>(f,t,cond):T
Defined in: packages/typegpu/src/std/boolean.ts:302
Type Parameters
Section titled “Type Parameters”• T extends number | boolean | AnyVecInstance
Parameters
Section titled “Parameters”T
T
boolean
Returns
Section titled “Returns”T
Call Signature
Section titled “Call Signature”select<
T>(f,t,cond):T
Defined in: packages/typegpu/src/std/boolean.ts:302
Type Parameters
Section titled “Type Parameters”• T extends AnyVecInstance
Parameters
Section titled “Parameters”T
T
T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b
Returns
Section titled “Returns”T