Replies: 4 comments 2 replies
-
IMHO just adding custom swizzle names would be better, but this would also be nice. |
Beta Was this translation helpful? Give feedback.
-
I think it would be more precise to say: export array indexing & swizzling syntax when |
Beta Was this translation helpful? Give feedback.
-
Slight issue, I'm getting an error when trying to use
HSB :: struct #raw_union {
using _: struct {
h, s, b: f32,
},
using _: [3]f32,
} |
Beta Was this translation helpful? Give feedback.
-
Not going to happen. I understand why you'd want this and we experimented with it a while ago too, but it screws up a lot of rules too with And in the grand scheme of things, this isn't that bad: HSB :: struct #raw_union {
using hsb: struct {h, s, b: f32},
e: [3]f32,
}
col: HSB
col.s = 0.5
col.e[1] = 0.5 // an extra 2 characters to type. |
Beta Was this translation helpful? Give feedback.
-
Right now, one cannot override the swizzle fields/set custom swizzle field order or names in an array type (which is understandable). A decent workaround seems to be creating a
#raw_union
with the struct and an array field. But direct array indexing of this struct isn't supported.Describe the solution you'd like
Allow direct array indexing of raw-unions, if there is only one array field member inside the raw union struct.
Additional context
None.
Beta Was this translation helpful? Give feedback.
All reactions