vec3b
Function
vec3b groups 3 components into a vector. A single scalar broadcasts to every component.
Compare examples
Compare a broadcast with distinct components and a zero value. Each component retains its position.
Example 1vec3b(true)
truetruetrue - Result
[true,true,true]
Example 2vec3b(true, true, true)
truetruetrue - Result
[true,true,true]
Example 3vec3b(false)
falsefalsefalse - Result
[false,false,false]
The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.
When to use it
Use vectors to represent coordinates, directions, colours, or several independent values of the same type.
Inputs and limits
A constructor does not normalize a direction. Integer, boolean, and floating-point vectors have different component types; this compiler emulates f64 vectors in software.
For shader input rules and precision, consult WGSL and GLSL ES 3.00.
Related functions
The signature, the sentence and any message are the compiler's own text at commit af54ddad5.
Builds a vec3b from three bool scalars, a vec2b and a scalar, broadcasts a single bool, or converts from a vec3 of a different element kind.
Syntax
declare function vec3b(): vec3bdeclare function vec3b(x: bool, y: bool, z: bool): vec3bdeclare function vec3b(v: vec2b, z: bool): vec3bdeclare function vec3b(x: bool, v: vec2b): vec3bdeclare function vec3b(scalar: bool): vec3bdeclare function vec3b(v: vec3b): vec3bdeclare function vec3b(v: vec3): vec3bdeclare function vec3b(v: vec3i): vec3bdeclare function vec3b(v: vec3u): vec3bParameters
Return value
vec3b
Description
A comparison of two vec3 values yields one.