refactor Complex.frag to support both float and double
new DoubleMath.frag for double precision trig etc
copy/pasted from old Complex.frag
builtin* captures for overloading (built in functions
can be redefined but not overloaded directly)
new ComplexBase.frag for (dual) complex maths using
REAL, VEC2, VEC3, VEC4 (number type agnostic)
Complex.frag is now a simple skeleton, that includes the
above two. If double is supported (tested by
VERSION >= 400) then REAL etc are redefined to the
double precision variants and ComplexBase is included
again.
User frags that wish to support both float and double
(using highest precision available) should set #version
and use REAL VEC2 etc. Then the only thing that needs
to be changed to support old hw is the #version.
User frags that wish to use both float and double at the
same time should use float, vec2 for low precision and
REAL, VEC2 for high precision. This will gracefully
downgrade to float for both if double is not supported.
If user frags absolutely need double precision, then
#version 400 compatibility and just use double, dvec2,
etc.
Tested briefly with BurningShip.frag, adding a #version
line doesn't break it horribly. DoubleTest.frag also
works fine.
refactor Complex.frag to support both float and double
new DoubleMath.frag for double precision trig etc
copy/pasted from old Complex.frag
builtin* captures for overloading (built in functions can be redefined but not overloaded directly)
new ComplexBase.frag for (dual) complex maths using REAL, VEC2, VEC3, VEC4 (number type agnostic)
Complex.frag is now a simple skeleton, that includes the above two. If double is supported (tested by VERSION >= 400) then REAL etc are redefined to the double precision variants and ComplexBase is included again.
User frags that wish to support both float and double (using highest precision available) should set #version and use REAL VEC2 etc. Then the only thing that needs to be changed to support old hw is the #version.
User frags that wish to use both float and double at the same time should use float, vec2 for low precision and REAL, VEC2 for high precision. This will gracefully downgrade to float for both if double is not supported.
If user frags absolutely need double precision, then
#version 400 compatibility
and just use double, dvec2, etc.Tested briefly with
BurningShip.frag
, adding a #version line doesn't break it horribly.DoubleTest.frag
also works fine.Closes: https://github.com/3Dickulus/FragM/issues/67
make DoubleMath safe to include on version < 400
more math functions for more GLSL versions
rename DoubleMath.frag to Math.frag
fix typo