We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enums are one of those basic features NZSL is still missing.
They would basically be an other name for an integer with typed values.
Simple enums would be used like this:
enum LightType { Directional, // underlying value: 0 PointLight, // underlying value: 1 SpotLight // underlying value: 2 }
and then they would be used like this:
let lightType = LightType.Directional; if (lightType != LightType.PointLight) // ...
casting from and to integer would be explicit:
let lightType = LightType(1); // LightType.PointLight let lightTypeInt = i32(lightType); // 1
It would also be necessary to be able to specify their underlying type and some values explicitly:
enum LightType : u32 // otherwise default underlying type would be i32 { Directional, // underlying value: 0u32 PointLight = 10, // underlying value: 10u32 SpotLight // underlying value: 11u32 }
I'd also like to support flags enums:
[flags] enum LightTypeMask // default underlying type: u32 { Directional, // implicit value: 1 Point, // implicit value: 2 Spot, // implicit value: 4 } // LightTypeMask supports &, | and ~ operators
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Enums are one of those basic features NZSL is still missing.
They would basically be an other name for an integer with typed values.
Simple enums would be used like this:
and then they would be used like this:
casting from and to integer would be explicit:
It would also be necessary to be able to specify their underlying type and some values explicitly:
I'd also like to support flags enums:
The text was updated successfully, but these errors were encountered: