Function EnableSwizzles
- EnableSwizzles(): void
Returns void
Example
import { Vec3, EnableSwizzles } from 'gl-matrix';
EnableSwizzles();
let v = new Vec3(0, 1, 2);
v.yx; // returns new Vec2(1, 0)
v.xzy; // returns new Vec3(0, 2, 1)
v.zyxz; // returns new Vec4(2, 1, 0, 2)
v.rgb; // returns new Vec3(0, 1, 2)
v.rbg; // returns new Vec3(0, 2, 1)
v.gg; // returns new Vec2(1, 1)
Enables Swizzle operations on gl-matrix.Vec2 | Vec2 / gl-matrix.Vec3 | Vec3 / gl-matrix.Vec4 | Vec4 types from gl-matrix | gl-matrix (32-bit).
Swizzle operations are performed by using the
.
operator in conjunction with any combination of between two and four component names, either from the setxyzw
orrgbw
(though not intermixed). They return a new vector with the same number of components as specified in the swizzle attribute.