[opengtl-commits] [687] add max, mix, clamp function |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 687
Author: cyrille
Date: 2009-03-26 10:43:16 +0100 (Thu, 26 Mar 2009)
Log Message:
-----------
add max, mix, clamp function
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva 2009-03-26 09:42:45 UTC (rev 686)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/shivastdlib.shiva 2009-03-26 09:43:16 UTC (rev 687)
@@ -41,4 +41,19 @@
if( a > b) return b;
return a;
}
+ float max(float a, float b)
+ {
+ if( a < b) return b;
+ return a;
+ }
+ float4 mix(float4 a, float4 b, float c)
+ {
+ return a * c + b * (1 - c);
+ }
+ float clamp(float a, float min, float max)
+ {
+ if( a < min ) return min;
+ if( a > max ) return max;
+ return a;
+ }
}