Function glm::builtin::mix_bool
[−]
[src]
pub fn mix_bool<F: BaseFloat, B: GenBType, T: NumBoolRel<F, B>>(
x: T,
y: T,
a: B
) -> T
Selects which vector each returned component comes from.
For a component of a that is false, the corresponding component of x
is returned. For a component of a that is true, the corresponding
component of y is returned. Components of x and y that are not
selected are allowed to be invalid floating point values and will have no
effect on the results.
Note
mix_boolis not a GLSL function name. It is a variant ofmixfunction and is introduced becasue Rust does not support function name overloading.- This function works for scalar types too.
Example
use glm::{ bvec4, dvec4, mix_bool }; let a = bvec4(true, false, false, true); let x = dvec4(1., 1., 1., 1.); let y = dvec4(2., 2., 2., 2.); assert_eq!(mix_bool(x, y, a), dvec4(2., 1., 1., 2.)); // works for scalars too. assert_eq!(mix_bool(1_f32, 2., false), 1.);