4 ms·
You'd rather use explicit function calls for all linear algebra and geometry operations? I don't think adding two vectors using an overloaded + is that spooky o
by Taywee 3y ago
You'd rather use explicit function calls for all linear algebra and geometry operations? I don't think adding two vectors using an overloaded + is that spooky or distant.
- flohofwoe 3y agoFWIW Zig can do that without operator overloading: https://www.godbolt.org/z/7zbxnncv6 https://www.godbolt.org/z/7zbxnncv6
- kprotty 3y agoVectors in Zig are SIMD types. Vectors in games are probably algebraic types. Using SIMD for the latter may not be that useful if 1) specific elements are accessed frequently 2) transformations involve a different operation happen on each element.
- cyber_kinetist 3y agoFirst of all that only works with vectors, but I want operator overloading to also work on things like matrices or custom types (for example quaterions, or a symmat3 struct that represents a symmetric 3x3 matrix using only 6 floats). Additionally, for efficient math code you often want vector / matrix types in AOSOA fasion: for example Vec3<Float8> to store an AVX lane for each X/Y/Z component. I want vector/matrix operations to work on SIMD lanes, not just for scalar types, and Zig currently can't support math operators on these kinds of types.
- felixgallo 3y agoI have a marvelous proof that you can solve that with comptime but unfortunately the margins of this website are too small to contain it.
- lvass 3y agoDo us a pastebin, please.
- QQ00 3y agoYou can use pastebin, or even better, use github gist.
- another2another 3y agoI think you have briefly deluded yourself with an irretrievable idea.