hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.87k stars 651 forks source link

internal/shader: support complex numbers #1303

Open hajimehoshi opened 4 years ago

hajimehoshi commented 4 years ago

Inspired by https://twitter.com/seanbax/status/1286018968172494849

tomlister commented 4 years ago

I'll have an attempt at this but as there's no milestone attached maybe not

tomlister commented 4 years ago

As glsl has no complex number support we can resolve i to sqrt(-1) in place. Additionally, as structs aren't implemented yet (I believe) we can just create two floats per complex number 0real & 0imag, 1real & 1imag, xreal & ximag...

hajimehoshi commented 4 years ago

This issue indicates about Go's constant number. No matter what the calculation process is, it is fine as long as the result is a real number: e.g., var foo [2]vec2; foo[1i-1i] should work. Another thing is real and imag builtin functions.

I don't set the milestone because this is not so important :-)