fuckingtech/public/assets/glsl/lygia/space/xyz2equirect.msl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

17 lines
No EOL
553 B
Text

#include "../math/const.msl"
/*
contributors: Patricio Gonzalez Vivo
description: 3D vector to equirect 2D projection
use: <float2> xyz2equirect(<float2> d)
license:
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
*/
#ifndef FNC_XYZ2EQUIRECT
#define FNC_XYZ2EQUIRECT
float2 xyz2equirect(float3 d) {
return float2(atan(d.z, d.x) + PI, acos(-d.y)) / float2(2.0 * PI, PI);
}
#endif