Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_math.h')
-rw-r--r--intern/cycles/util/util_math.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index a4d49681a38..2262f8fdbb7 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -175,6 +175,15 @@ ccl_device_inline float clamp(float a, float mn, float mx)
#endif
+#ifndef __KERNEL_CUDA__
+
+ccl_device_inline float saturate(float a)
+{
+ return clamp(a, 0.0f, 1.0f);
+}
+
+#endif
+
ccl_device_inline int float_to_int(float f)
{
return (int)f;
@@ -1461,9 +1470,9 @@ ccl_device_inline float2 map_to_tube(const float3 co)
{
float len, u, v;
len = sqrtf(co.x * co.x + co.y * co.y);
- if (len > 0.0f) {
+ if(len > 0.0f) {
u = (1.0f - (atan2f(co.x / len, co.y / len) / M_PI_F)) * 0.5f;
- v = (co.x + 1.0f) * 0.5f;
+ v = (co.z + 1.0f) * 0.5f;
}
else {
u = v = 0.0f;