@@ -184,6 +184,22 @@ int isfinite (float x) BUILTIN;
184184float erf (float x ) BUILTIN ;
185185float erfc (float x ) BUILTIN ;
186186
187+ // Currently, only implemented for 'vector' and 'float' types.
188+ #if 0
189+ // normal remap(normal x, normal minIn, normal maxIn, normal minOut, normal maxOut) { return 1; }
190+ vector remap (vector x , vector minIn , vector maxIn , float minOut , float maxOut ) { return minOut + (x - minIn ) * (maxOut - minOut ) / (maxIn - minIn ); }
191+ vector remap (vector x , vector minIn , vector maxIn , vector minOut , vector maxOut ) { return minOut + (x - minIn ) * (maxOut - minOut ) / (maxIn - minIn ); }
192+ // point remap(point x, point minIn, point maxIn, point minOut, point maxOut) { return 1; }
193+ // color remap(color x, color minIn, color maxIn, color minOut, color maxOut) { return 1; }
194+ float remap (float x , float minIn , float maxIn , float minOut , float maxOut ) { return minOut + (x - minIn ) * (maxOut - minOut ) / (maxIn - minIn ); }
195+ #else
196+ vector remap (vector x , vector minIn , vector maxIn , float minOut , float maxOut ) BUILTIN ;
197+ vector remap (vector x , vector minIn , vector maxIn , vector minOut , vector maxOut ) BUILTIN ;
198+ float remap (float x , float minIn , float maxIn , float minOut , float maxOut ) BUILTIN ;
199+ #endif
200+ closure color remap (closure x , closure minIn , closure maxIn , float minOut , float maxOut ) { return minOut + (x - minIn ) * (maxOut - minOut ) / (maxIn - minIn ); }
201+ closure color remap (closure x , closure minIn , closure maxIn , closure minOut , closure maxOut ) { return minOut + (x - minIn ) * (maxOut - minOut ) / (maxIn - minIn ); }
202+
187203// Vector functions
188204
189205vector cross (vector a , vector b ) BUILTIN ;
0 commit comments