MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / atan2

Method atan2

src/OpenColorIO/GpuShaderUtils.cpp:1309–1348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307}
1308
1309std::string GpuShaderText::atan2(const std::string & y,
1310 const std::string & x) const
1311{
1312 std::ostringstream kw;
1313 switch(m_lang)
1314 {
1315 case GPU_LANGUAGE_CG:
1316 case GPU_LANGUAGE_GLSL_1_2:
1317 case GPU_LANGUAGE_GLSL_1_3:
1318 case GPU_LANGUAGE_GLSL_4_0:
1319 case GPU_LANGUAGE_GLSL_VK_4_6:
1320 case GPU_LANGUAGE_GLSL_ES_1_0:
1321 case GPU_LANGUAGE_GLSL_ES_3_0:
1322 {
1323 // note: "atan" not "atan2"
1324 kw << "atan(" << y << ", " << x << ")";
1325 break;
1326 }
1327 case GPU_LANGUAGE_HLSL_SM_5_0:
1328 {
1329 // note: Various internet sources claim that the x & y arguments need to be
1330 // swapped for HLSL (relative to GLSL). However, recent testing on Windows
1331 // has revealed that the argument order needs to be the same as GLSL.
1332 kw << "atan2(" << y << ", " << x << ")";
1333 break;
1334 }
1335 case LANGUAGE_OSL_1:
1336 case GPU_LANGUAGE_MSL_2_0:
1337 {
1338 kw << "atan2(" << y << ", " << x << ")";
1339 break;
1340 }
1341
1342 default:
1343 {
1344 throw Exception("Unknown GPU shader language.");
1345 }
1346 }
1347 return kw.str();
1348}
1349
1350std::string GpuShaderText::sign(const std::string & v) const
1351{

Callers 3

Add_hue_weight_shaderFunction · 0.80
_Add_Aab_to_JMh_ShaderFunction · 0.80
slick.min.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected