9 ms·
Probably not. @Vector is not a mathematical vector, it's SIMD. it makes sense because there are times when those live in registers and a poly fill for stack me
by throwawaymaths 3y ago
Probably not. @Vector is not a mathematical vector, it's SIMD. it makes sense because there are times when those live in registers and a poly fill for stack memory isn't burdensome.
@Matrix makes less sense because when it gets big, where are you getting memory from?
- flohofwoe 3y agoFor 'game-ey' math code, a matrix is at most 4x4 floats (64 bytes), that's fine for a value type that might live on the stack. vec2..4 and matching matrix types up to 4x4 is basically also what's provided in GPU shading languages as primitive types, and personally I would prefer such a set of "SIMD-y" primitive types for Zig (maybe a bit more luxurious than @Vector, e.g. with things like component swizzling syntax - basically what this Clang extension offers: https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors https://clang.llvm.org/docs/LanguageExtensions.html#vectors-...).
- cmbothwell 3y agoYou might like Odin, it has a similar philosophy to Zig and supports swizzling: https://odin-lang.org/docs/overview/#swizzle-operations https://odin-lang.org/docs/overview/#swizzle-operations Matrix types are also built in: https://odin-lang.org/docs/overview/#matrix-type https://odin-lang.org/docs/overview/#matrix-type I’ve thought for a little while that Odin could be a secret weapon for game dev and similar pieces of software.
- flohofwoe 3y agoI'm actually dabbling with Odin a bit in the scope of language bindings for the sokol headers: https://github.com/floooh/sokol-odin https://github.com/floooh/sokol-odin It's a very enjoyable language!
- throwawaymaths 3y agoSure, but people are going to want to use operator overloading for, e.g. dl/ml