Closed sin-ack closed 2 years ago
Now that I did this, I'm wondering whether there is a better way to do this by allowing TextureUnit
to generate these arbitrary values itself:
const TextureUnit = enum(types.Enum) {
texture_0,
// ...
_,
pub fn unit(id: types.Enum) TextureUnit {
return @intToEnum(TextureUnit, @enumToInt(texture_0) + id);
}
};
This could then be used like zgl.activeTexture(zgl.TextureUnit.unit(20));
, which might be nicer. What do you think?
Ended up switching over to this, as it is nicer.
TextureUnit is now non-exhaustive which allows one to specify other texture units than the ones defined. Additionally, this commit adds the TextureUnit.unit function which allows one to generate these texture units easily.
Closes #54