EmbarkStudios / rust-gpu

🐉 Making Rust a first-class language and ecosystem for GPU shaders 🚧
https://shader.rs
Apache License 2.0
7.28k stars 246 forks source link

Operator Overlaoding support #1149

Open Makogan opened 4 months ago

Makogan commented 4 months ago

Currently, it seems that rustgpu does not support operator overloading (there is no ops module under spirv_std, and none of the examples seem to do this).

This is useful because although linear algebra is the most popular mathematical representation for transformations in computer graphics, it is not the only option.

For example, I currently use projective geometric algebra for skin animations. To do this I need to define a multivector type on the shader that is capable of addition, multiplication, scalar multiplication...

Of course, one can work around the issue by defining methods, but this is less ergonomic than having operators.

FishArmy100 commented 4 months ago

I thought there was a form of operator overloading via glam? Though, I might be mistaken.

Patryk27 commented 3 months ago

there is no ops module under spirv_std, and none of the examples seem to do this

But there's core::ops, no? spirv_std is just a couple of extra stuff - it just complements core, not replaces it.