towardsEyeFrom function
TowardsEyeFrom of contributor_eye.glsl: the unit direction back along
the ray that reached a point, nought at the eye.
Implementation
Vector3 towardsEyeFrom(ShaderBindings b, double x, double y, double z) {
if (orthographic(b)) {
final forward = b.vec4('FogInfo', 'forward', Vector4.zero());
return Vector3(-forward.x, -forward.y, -forward.z);
}
final eye = b.vec4('FogInfo', 'eye', Vector4.zero());
final to = Vector3(eye.x - x, eye.y - y, eye.z - z);
return to.length2 > 0.0 ? (to..normalize()) : to;
}