Skip to content

Instantly share code, notes, and snippets.

@chenglou
Created December 4, 2024 01:36
Show Gist options
  • Save chenglou/da543cdf14087b22f56275c9ff25c1f4 to your computer and use it in GitHub Desktop.
Save chenglou/da543cdf14087b22f56275c9ff25c1f4 to your computer and use it in GitHub Desktop.
Swizzle file size
class Vec2 {
x: number
y: number
constructor(x: number, y: number) {
this.x = x
this.y = y
}
get xx() { return new Vec2(this.x, this.x) }
get xy() { return new Vec2(this.x, this.y) }
get yx() { return new Vec2(this.y, this.x) }
get yy() { return new Vec2(this.y, this.y) }
get xxx() { return new Vec3(this.x, this.x, this.x) }
get xxy() { return new Vec3(this.x, this.x, this.y) }
get xyx() { return new Vec3(this.x, this.y, this.x) }
get xyy() { return new Vec3(this.x, this.y, this.y) }
get yxx() { return new Vec3(this.y, this.x, this.x) }
get yxy() { return new Vec3(this.y, this.x, this.y) }
get yyx() { return new Vec3(this.y, this.y, this.x) }
get yyy() { return new Vec3(this.y, this.y, this.y) }
get xxxx() { return new Vec4(this.x, this.x, this.x, this.x) }
get xxxy() { return new Vec4(this.x, this.x, this.x, this.y) }
get xxyx() { return new Vec4(this.x, this.x, this.y, this.x) }
get xxyy() { return new Vec4(this.x, this.x, this.y, this.y) }
get xyxx() { return new Vec4(this.x, this.y, this.x, this.x) }
get xyxy() { return new Vec4(this.x, this.y, this.x, this.y) }
get xyyx() { return new Vec4(this.x, this.y, this.y, this.x) }
get xyyy() { return new Vec4(this.x, this.y, this.y, this.y) }
get yxxx() { return new Vec4(this.y, this.x, this.x, this.x) }
get yxxy() { return new Vec4(this.y, this.x, this.x, this.y) }
get yxyx() { return new Vec4(this.y, this.x, this.y, this.x) }
get yxyy() { return new Vec4(this.y, this.x, this.y, this.y) }
get yyxx() { return new Vec4(this.y, this.y, this.x, this.x) }
get yyxy() { return new Vec4(this.y, this.y, this.x, this.y) }
get yyyx() { return new Vec4(this.y, this.y, this.y, this.x) }
get yyyy() { return new Vec4(this.y, this.y, this.y, this.y) }
toString() { return `vec2(${this.x}, ${this.y})` }
[Symbol.for('nodejs.util.inspect.custom')]() { return this.toString() }
}
function vec2(x: number, y: number): Vec2 { return new Vec2(x, y) }
class Vec3 extends Vec2 {
z: number
constructor(x: number, y: number, z: number) {
super(x, y)
this.z = z
}
get xz() { return new Vec2(this.x, this.z) }
get yz() { return new Vec2(this.y, this.z) }
get zx() { return new Vec2(this.z, this.x) }
get zy() { return new Vec2(this.z, this.y) }
get zz() { return new Vec2(this.z, this.z) }
get xxz() { return new Vec3(this.x, this.x, this.z) }
get xyz() { return new Vec3(this.x, this.y, this.z) }
get xzx() { return new Vec3(this.x, this.z, this.x) }
get xzy() { return new Vec3(this.x, this.z, this.y) }
get xzz() { return new Vec3(this.x, this.z, this.z) }
get yxz() { return new Vec3(this.y, this.x, this.z) }
get yyz() { return new Vec3(this.y, this.y, this.z) }
get yzx() { return new Vec3(this.y, this.z, this.x) }
get yzy() { return new Vec3(this.y, this.z, this.y) }
get yzz() { return new Vec3(this.y, this.z, this.z) }
get zxx() { return new Vec3(this.z, this.x, this.x) }
get zxy() { return new Vec3(this.z, this.x, this.y) }
get zxz() { return new Vec3(this.z, this.x, this.z) }
get zyx() { return new Vec3(this.z, this.y, this.x) }
get zyy() { return new Vec3(this.z, this.y, this.y) }
get zyz() { return new Vec3(this.z, this.y, this.z) }
get zzx() { return new Vec3(this.z, this.z, this.x) }
get zzy() { return new Vec3(this.z, this.z, this.y) }
get zzz() { return new Vec3(this.z, this.z, this.z) }
get xxxz() { return new Vec4(this.x, this.x, this.x, this.z) }
get xxyz() { return new Vec4(this.x, this.x, this.y, this.z) }
get xxzx() { return new Vec4(this.x, this.x, this.z, this.x) }
get xxzy() { return new Vec4(this.x, this.x, this.z, this.y) }
get xxzz() { return new Vec4(this.x, this.x, this.z, this.z) }
get xyxz() { return new Vec4(this.x, this.y, this.x, this.z) }
get xyyz() { return new Vec4(this.x, this.y, this.y, this.z) }
get xyzx() { return new Vec4(this.x, this.y, this.z, this.x) }
get xyzy() { return new Vec4(this.x, this.y, this.z, this.y) }
get xyzz() { return new Vec4(this.x, this.y, this.z, this.z) }
get xzxx() { return new Vec4(this.x, this.z, this.x, this.x) }
get xzxy() { return new Vec4(this.x, this.z, this.x, this.y) }
get xzxz() { return new Vec4(this.x, this.z, this.x, this.z) }
get xzyx() { return new Vec4(this.x, this.z, this.y, this.x) }
get xzyy() { return new Vec4(this.x, this.z, this.y, this.y) }
get xzyz() { return new Vec4(this.x, this.z, this.y, this.z) }
get xzzx() { return new Vec4(this.x, this.z, this.z, this.x) }
get xzzy() { return new Vec4(this.x, this.z, this.z, this.y) }
get xzzz() { return new Vec4(this.x, this.z, this.z, this.z) }
get yxxz() { return new Vec4(this.y, this.x, this.x, this.z) }
get yxyz() { return new Vec4(this.y, this.x, this.y, this.z) }
get yxzx() { return new Vec4(this.y, this.x, this.z, this.x) }
get yxzy() { return new Vec4(this.y, this.x, this.z, this.y) }
get yxzz() { return new Vec4(this.y, this.x, this.z, this.z) }
get yyxz() { return new Vec4(this.y, this.y, this.x, this.z) }
get yyyz() { return new Vec4(this.y, this.y, this.y, this.z) }
get yyzx() { return new Vec4(this.y, this.y, this.z, this.x) }
get yyzy() { return new Vec4(this.y, this.y, this.z, this.y) }
get yyzz() { return new Vec4(this.y, this.y, this.z, this.z) }
get yzxx() { return new Vec4(this.y, this.z, this.x, this.x) }
get yzxy() { return new Vec4(this.y, this.z, this.x, this.y) }
get yzxz() { return new Vec4(this.y, this.z, this.x, this.z) }
get yzyx() { return new Vec4(this.y, this.z, this.y, this.x) }
get yzyy() { return new Vec4(this.y, this.z, this.y, this.y) }
get yzyz() { return new Vec4(this.y, this.z, this.y, this.z) }
get yzzx() { return new Vec4(this.y, this.z, this.z, this.x) }
get yzzy() { return new Vec4(this.y, this.z, this.z, this.y) }
get yzzz() { return new Vec4(this.y, this.z, this.z, this.z) }
get zxxx() { return new Vec4(this.z, this.x, this.x, this.x) }
get zxxy() { return new Vec4(this.z, this.x, this.x, this.y) }
get zxxz() { return new Vec4(this.z, this.x, this.x, this.z) }
get zxyx() { return new Vec4(this.z, this.x, this.y, this.x) }
get zxyy() { return new Vec4(this.z, this.x, this.y, this.y) }
get zxyz() { return new Vec4(this.z, this.x, this.y, this.z) }
get zxzx() { return new Vec4(this.z, this.x, this.z, this.x) }
get zxzy() { return new Vec4(this.z, this.x, this.z, this.y) }
get zxzz() { return new Vec4(this.z, this.x, this.z, this.z) }
get zyxx() { return new Vec4(this.z, this.y, this.x, this.x) }
get zyxy() { return new Vec4(this.z, this.y, this.x, this.y) }
get zyxz() { return new Vec4(this.z, this.y, this.x, this.z) }
get zyyx() { return new Vec4(this.z, this.y, this.y, this.x) }
get zyyy() { return new Vec4(this.z, this.y, this.y, this.y) }
get zyyz() { return new Vec4(this.z, this.y, this.y, this.z) }
get zyzx() { return new Vec4(this.z, this.y, this.z, this.x) }
get zyzy() { return new Vec4(this.z, this.y, this.z, this.y) }
get zyzz() { return new Vec4(this.z, this.y, this.z, this.z) }
get zzxx() { return new Vec4(this.z, this.z, this.x, this.x) }
get zzxy() { return new Vec4(this.z, this.z, this.x, this.y) }
get zzxz() { return new Vec4(this.z, this.z, this.x, this.z) }
get zzyx() { return new Vec4(this.z, this.z, this.y, this.x) }
get zzyy() { return new Vec4(this.z, this.z, this.y, this.y) }
get zzyz() { return new Vec4(this.z, this.z, this.y, this.z) }
get zzzx() { return new Vec4(this.z, this.z, this.z, this.x) }
get zzzy() { return new Vec4(this.z, this.z, this.z, this.y) }
get zzzz() { return new Vec4(this.z, this.z, this.z, this.z) }
toString() { return `vec3(${this.x}, ${this.y}, ${this.z})` }
}
function vec3(x: number, y: number, z: number): Vec3 { return new Vec3(x, y, z) }
class Vec4 extends Vec3 {
w: number
constructor(x: number, y: number, z: number, w: number) {
super(x, y, z)
this.w = w
}
get xw() { return new Vec2(this.x, this.w) }
get yw() { return new Vec2(this.y, this.w) }
get zw() { return new Vec2(this.z, this.w) }
get wx() { return new Vec2(this.w, this.x) }
get wy() { return new Vec2(this.w, this.y) }
get wz() { return new Vec2(this.w, this.z) }
get ww() { return new Vec2(this.w, this.w) }
get xxw() { return new Vec3(this.x, this.x, this.w) }
get xyw() { return new Vec3(this.x, this.y, this.w) }
get xzw() { return new Vec3(this.x, this.z, this.w) }
get xwx() { return new Vec3(this.x, this.w, this.x) }
get xwy() { return new Vec3(this.x, this.w, this.y) }
get xwz() { return new Vec3(this.x, this.w, this.z) }
get xww() { return new Vec3(this.x, this.w, this.w) }
get yxw() { return new Vec3(this.y, this.x, this.w) }
get yyw() { return new Vec3(this.y, this.y, this.w) }
get yzw() { return new Vec3(this.y, this.z, this.w) }
get ywx() { return new Vec3(this.y, this.w, this.x) }
get ywy() { return new Vec3(this.y, this.w, this.y) }
get ywz() { return new Vec3(this.y, this.w, this.z) }
get yww() { return new Vec3(this.y, this.w, this.w) }
get zxw() { return new Vec3(this.z, this.x, this.w) }
get zyw() { return new Vec3(this.z, this.y, this.w) }
get zzw() { return new Vec3(this.z, this.z, this.w) }
get zwx() { return new Vec3(this.z, this.w, this.x) }
get zwy() { return new Vec3(this.z, this.w, this.y) }
get zwz() { return new Vec3(this.z, this.w, this.z) }
get zww() { return new Vec3(this.z, this.w, this.w) }
get wxx() { return new Vec3(this.w, this.x, this.x) }
get wxy() { return new Vec3(this.w, this.x, this.y) }
get wxz() { return new Vec3(this.w, this.x, this.z) }
get wxw() { return new Vec3(this.w, this.x, this.w) }
get wyx() { return new Vec3(this.w, this.y, this.x) }
get wyy() { return new Vec3(this.w, this.y, this.y) }
get wyz() { return new Vec3(this.w, this.y, this.z) }
get wyw() { return new Vec3(this.w, this.y, this.w) }
get wzx() { return new Vec3(this.w, this.z, this.x) }
get wzy() { return new Vec3(this.w, this.z, this.y) }
get wzz() { return new Vec3(this.w, this.z, this.z) }
get wzw() { return new Vec3(this.w, this.z, this.w) }
get wwx() { return new Vec3(this.w, this.w, this.x) }
get wwy() { return new Vec3(this.w, this.w, this.y) }
get wwz() { return new Vec3(this.w, this.w, this.z) }
get www() { return new Vec3(this.w, this.w, this.w) }
get xxxw() { return new Vec4(this.x, this.x, this.x, this.w) }
get xxyw() { return new Vec4(this.x, this.x, this.y, this.w) }
get xxzw() { return new Vec4(this.x, this.x, this.z, this.w) }
get xxwx() { return new Vec4(this.x, this.x, this.w, this.x) }
get xxwy() { return new Vec4(this.x, this.x, this.w, this.y) }
get xxwz() { return new Vec4(this.x, this.x, this.w, this.z) }
get xxww() { return new Vec4(this.x, this.x, this.w, this.w) }
get xyxw() { return new Vec4(this.x, this.y, this.x, this.w) }
get xyyw() { return new Vec4(this.x, this.y, this.y, this.w) }
get xyzw() { return new Vec4(this.x, this.y, this.z, this.w) }
get xywx() { return new Vec4(this.x, this.y, this.w, this.x) }
get xywy() { return new Vec4(this.x, this.y, this.w, this.y) }
get xywz() { return new Vec4(this.x, this.y, this.w, this.z) }
get xyww() { return new Vec4(this.x, this.y, this.w, this.w) }
get xzxw() { return new Vec4(this.x, this.z, this.x, this.w) }
get xzyw() { return new Vec4(this.x, this.z, this.y, this.w) }
get xzzw() { return new Vec4(this.x, this.z, this.z, this.w) }
get xzwx() { return new Vec4(this.x, this.z, this.w, this.x) }
get xzwy() { return new Vec4(this.x, this.z, this.w, this.y) }
get xzwz() { return new Vec4(this.x, this.z, this.w, this.z) }
get xzww() { return new Vec4(this.x, this.z, this.w, this.w) }
get xwxx() { return new Vec4(this.x, this.w, this.x, this.x) }
get xwxy() { return new Vec4(this.x, this.w, this.x, this.y) }
get xwxz() { return new Vec4(this.x, this.w, this.x, this.z) }
get xwxw() { return new Vec4(this.x, this.w, this.x, this.w) }
get xwyx() { return new Vec4(this.x, this.w, this.y, this.x) }
get xwyy() { return new Vec4(this.x, this.w, this.y, this.y) }
get xwyz() { return new Vec4(this.x, this.w, this.y, this.z) }
get xwyw() { return new Vec4(this.x, this.w, this.y, this.w) }
get xwzx() { return new Vec4(this.x, this.w, this.z, this.x) }
get xwzy() { return new Vec4(this.x, this.w, this.z, this.y) }
get xwzz() { return new Vec4(this.x, this.w, this.z, this.z) }
get xwzw() { return new Vec4(this.x, this.w, this.z, this.w) }
get xwwx() { return new Vec4(this.x, this.w, this.w, this.x) }
get xwwy() { return new Vec4(this.x, this.w, this.w, this.y) }
get xwwz() { return new Vec4(this.x, this.w, this.w, this.z) }
get xwww() { return new Vec4(this.x, this.w, this.w, this.w) }
get yxxw() { return new Vec4(this.y, this.x, this.x, this.w) }
get yxyw() { return new Vec4(this.y, this.x, this.y, this.w) }
get yxzw() { return new Vec4(this.y, this.x, this.z, this.w) }
get yxwx() { return new Vec4(this.y, this.x, this.w, this.x) }
get yxwy() { return new Vec4(this.y, this.x, this.w, this.y) }
get yxwz() { return new Vec4(this.y, this.x, this.w, this.z) }
get yxww() { return new Vec4(this.y, this.x, this.w, this.w) }
get yyxw() { return new Vec4(this.y, this.y, this.x, this.w) }
get yyyw() { return new Vec4(this.y, this.y, this.y, this.w) }
get yyzw() { return new Vec4(this.y, this.y, this.z, this.w) }
get yywx() { return new Vec4(this.y, this.y, this.w, this.x) }
get yywy() { return new Vec4(this.y, this.y, this.w, this.y) }
get yywz() { return new Vec4(this.y, this.y, this.w, this.z) }
get yyww() { return new Vec4(this.y, this.y, this.w, this.w) }
get yzxw() { return new Vec4(this.y, this.z, this.x, this.w) }
get yzyw() { return new Vec4(this.y, this.z, this.y, this.w) }
get yzzw() { return new Vec4(this.y, this.z, this.z, this.w) }
get yzwx() { return new Vec4(this.y, this.z, this.w, this.x) }
get yzwy() { return new Vec4(this.y, this.z, this.w, this.y) }
get yzwz() { return new Vec4(this.y, this.z, this.w, this.z) }
get yzww() { return new Vec4(this.y, this.z, this.w, this.w) }
get ywxx() { return new Vec4(this.y, this.w, this.x, this.x) }
get ywxy() { return new Vec4(this.y, this.w, this.x, this.y) }
get ywxz() { return new Vec4(this.y, this.w, this.x, this.z) }
get ywxw() { return new Vec4(this.y, this.w, this.x, this.w) }
get ywyx() { return new Vec4(this.y, this.w, this.y, this.x) }
get ywyy() { return new Vec4(this.y, this.w, this.y, this.y) }
get ywyz() { return new Vec4(this.y, this.w, this.y, this.z) }
get ywyw() { return new Vec4(this.y, this.w, this.y, this.w) }
get ywzx() { return new Vec4(this.y, this.w, this.z, this.x) }
get ywzy() { return new Vec4(this.y, this.w, this.z, this.y) }
get ywzz() { return new Vec4(this.y, this.w, this.z, this.z) }
get ywzw() { return new Vec4(this.y, this.w, this.z, this.w) }
get ywwx() { return new Vec4(this.y, this.w, this.w, this.x) }
get ywwy() { return new Vec4(this.y, this.w, this.w, this.y) }
get ywwz() { return new Vec4(this.y, this.w, this.w, this.z) }
get ywww() { return new Vec4(this.y, this.w, this.w, this.w) }
get zxxw() { return new Vec4(this.z, this.x, this.x, this.w) }
get zxyw() { return new Vec4(this.z, this.x, this.y, this.w) }
get zxzw() { return new Vec4(this.z, this.x, this.z, this.w) }
get zxwx() { return new Vec4(this.z, this.x, this.w, this.x) }
get zxwy() { return new Vec4(this.z, this.x, this.w, this.y) }
get zxwz() { return new Vec4(this.z, this.x, this.w, this.z) }
get zxww() { return new Vec4(this.z, this.x, this.w, this.w) }
get zyxw() { return new Vec4(this.z, this.y, this.x, this.w) }
get zyyw() { return new Vec4(this.z, this.y, this.y, this.w) }
get zyzw() { return new Vec4(this.z, this.y, this.z, this.w) }
get zywx() { return new Vec4(this.z, this.y, this.w, this.x) }
get zywy() { return new Vec4(this.z, this.y, this.w, this.y) }
get zywz() { return new Vec4(this.z, this.y, this.w, this.z) }
get zyww() { return new Vec4(this.z, this.y, this.w, this.w) }
get zzxw() { return new Vec4(this.z, this.z, this.x, this.w) }
get zzyw() { return new Vec4(this.z, this.z, this.y, this.w) }
get zzzw() { return new Vec4(this.z, this.z, this.z, this.w) }
get zzwx() { return new Vec4(this.z, this.z, this.w, this.x) }
get zzwy() { return new Vec4(this.z, this.z, this.w, this.y) }
get zzwz() { return new Vec4(this.z, this.z, this.w, this.z) }
get zzww() { return new Vec4(this.z, this.z, this.w, this.w) }
get zwxx() { return new Vec4(this.z, this.w, this.x, this.x) }
get zwxy() { return new Vec4(this.z, this.w, this.x, this.y) }
get zwxz() { return new Vec4(this.z, this.w, this.x, this.z) }
get zwxw() { return new Vec4(this.z, this.w, this.x, this.w) }
get zwyx() { return new Vec4(this.z, this.w, this.y, this.x) }
get zwyy() { return new Vec4(this.z, this.w, this.y, this.y) }
get zwyz() { return new Vec4(this.z, this.w, this.y, this.z) }
get zwyw() { return new Vec4(this.z, this.w, this.y, this.w) }
get zwzx() { return new Vec4(this.z, this.w, this.z, this.x) }
get zwzy() { return new Vec4(this.z, this.w, this.z, this.y) }
get zwzz() { return new Vec4(this.z, this.w, this.z, this.z) }
get zwzw() { return new Vec4(this.z, this.w, this.z, this.w) }
get zwwx() { return new Vec4(this.z, this.w, this.w, this.x) }
get zwwy() { return new Vec4(this.z, this.w, this.w, this.y) }
get zwwz() { return new Vec4(this.z, this.w, this.w, this.z) }
get zwww() { return new Vec4(this.z, this.w, this.w, this.w) }
get wxxx() { return new Vec4(this.w, this.x, this.x, this.x) }
get wxxy() { return new Vec4(this.w, this.x, this.x, this.y) }
get wxxz() { return new Vec4(this.w, this.x, this.x, this.z) }
get wxxw() { return new Vec4(this.w, this.x, this.x, this.w) }
get wxyx() { return new Vec4(this.w, this.x, this.y, this.x) }
get wxyy() { return new Vec4(this.w, this.x, this.y, this.y) }
get wxyz() { return new Vec4(this.w, this.x, this.y, this.z) }
get wxyw() { return new Vec4(this.w, this.x, this.y, this.w) }
get wxzx() { return new Vec4(this.w, this.x, this.z, this.x) }
get wxzy() { return new Vec4(this.w, this.x, this.z, this.y) }
get wxzz() { return new Vec4(this.w, this.x, this.z, this.z) }
get wxzw() { return new Vec4(this.w, this.x, this.z, this.w) }
get wxwx() { return new Vec4(this.w, this.x, this.w, this.x) }
get wxwy() { return new Vec4(this.w, this.x, this.w, this.y) }
get wxwz() { return new Vec4(this.w, this.x, this.w, this.z) }
get wxww() { return new Vec4(this.w, this.x, this.w, this.w) }
get wyxx() { return new Vec4(this.w, this.y, this.x, this.x) }
get wyxy() { return new Vec4(this.w, this.y, this.x, this.y) }
get wyxz() { return new Vec4(this.w, this.y, this.x, this.z) }
get wyxw() { return new Vec4(this.w, this.y, this.x, this.w) }
get wyyx() { return new Vec4(this.w, this.y, this.y, this.x) }
get wyyy() { return new Vec4(this.w, this.y, this.y, this.y) }
get wyyz() { return new Vec4(this.w, this.y, this.y, this.z) }
get wyyw() { return new Vec4(this.w, this.y, this.y, this.w) }
get wyzx() { return new Vec4(this.w, this.y, this.z, this.x) }
get wyzy() { return new Vec4(this.w, this.y, this.z, this.y) }
get wyzz() { return new Vec4(this.w, this.y, this.z, this.z) }
get wyzw() { return new Vec4(this.w, this.y, this.z, this.w) }
get wywx() { return new Vec4(this.w, this.y, this.w, this.x) }
get wywy() { return new Vec4(this.w, this.y, this.w, this.y) }
get wywz() { return new Vec4(this.w, this.y, this.w, this.z) }
get wyww() { return new Vec4(this.w, this.y, this.w, this.w) }
get wzxx() { return new Vec4(this.w, this.z, this.x, this.x) }
get wzxy() { return new Vec4(this.w, this.z, this.x, this.y) }
get wzxz() { return new Vec4(this.w, this.z, this.x, this.z) }
get wzxw() { return new Vec4(this.w, this.z, this.x, this.w) }
get wzyx() { return new Vec4(this.w, this.z, this.y, this.x) }
get wzyy() { return new Vec4(this.w, this.z, this.y, this.y) }
get wzyz() { return new Vec4(this.w, this.z, this.y, this.z) }
get wzyw() { return new Vec4(this.w, this.z, this.y, this.w) }
get wzzx() { return new Vec4(this.w, this.z, this.z, this.x) }
get wzzy() { return new Vec4(this.w, this.z, this.z, this.y) }
get wzzz() { return new Vec4(this.w, this.z, this.z, this.z) }
get wzzw() { return new Vec4(this.w, this.z, this.z, this.w) }
get wzwx() { return new Vec4(this.w, this.z, this.w, this.x) }
get wzwy() { return new Vec4(this.w, this.z, this.w, this.y) }
get wzwz() { return new Vec4(this.w, this.z, this.w, this.z) }
get wzww() { return new Vec4(this.w, this.z, this.w, this.w) }
get wwxx() { return new Vec4(this.w, this.w, this.x, this.x) }
get wwxy() { return new Vec4(this.w, this.w, this.x, this.y) }
get wwxz() { return new Vec4(this.w, this.w, this.x, this.z) }
get wwxw() { return new Vec4(this.w, this.w, this.x, this.w) }
get wwyx() { return new Vec4(this.w, this.w, this.y, this.x) }
get wwyy() { return new Vec4(this.w, this.w, this.y, this.y) }
get wwyz() { return new Vec4(this.w, this.w, this.y, this.z) }
get wwyw() { return new Vec4(this.w, this.w, this.y, this.w) }
get wwzx() { return new Vec4(this.w, this.w, this.z, this.x) }
get wwzy() { return new Vec4(this.w, this.w, this.z, this.y) }
get wwzz() { return new Vec4(this.w, this.w, this.z, this.z) }
get wwzw() { return new Vec4(this.w, this.w, this.z, this.w) }
get wwwx() { return new Vec4(this.w, this.w, this.w, this.x) }
get wwwy() { return new Vec4(this.w, this.w, this.w, this.y) }
get wwwz() { return new Vec4(this.w, this.w, this.w, this.z) }
get wwww() { return new Vec4(this.w, this.w, this.w, this.w) }
toString() { return `vec4(${this.x}, ${this.y}, ${this.z}, ${this.w})` }
}
function vec4(x: number, y: number, z: number, w: number): Vec4 { return new Vec4(x, y, z, w) }
@chenglou
Copy link
Author

chenglou commented Dec 4, 2024

❯ du -khd 1 src/swizzle.ts.gz
4.0K src/swizzle.ts.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment