@@ -319,73 +319,73 @@ point step (point edge, point x) BUILTIN;
319319vector step (vector edge , vector x ) BUILTIN ;
320320normal step (normal edge , normal x ) BUILTIN ;
321321float step (float edge , float x ) BUILTIN ;
322- float smoothstep (float edge0 , float edge1 , float x ) BUILTIN ;
322+ float smoothstep (float low , float high , float x ) BUILTIN ;
323323
324- color smoothstep (color edge0 , color edge1 , color x )
324+ color smoothstep (color low , color high , color x )
325325{
326- return color (smoothstep (edge0 [0 ], edge1 [0 ], x [0 ]),
327- smoothstep (edge0 [1 ], edge1 [1 ], x [1 ]),
328- smoothstep (edge0 [2 ], edge1 [2 ], x [2 ]));
326+ return color (smoothstep (low [0 ], high [0 ], x [0 ]),
327+ smoothstep (low [1 ], high [1 ], x [1 ]),
328+ smoothstep (low [2 ], high [2 ], x [2 ]));
329329}
330- vector smoothstep (vector edge0 , vector edge1 , vector x )
330+ vector smoothstep (vector low , vector high , vector x )
331331{
332- return vector (smoothstep (edge0 [0 ], edge1 [0 ], x [0 ]),
333- smoothstep (edge0 [1 ], edge1 [1 ], x [1 ]),
334- smoothstep (edge0 [2 ], edge1 [2 ], x [2 ]));
332+ return vector (smoothstep (low [0 ], high [0 ], x [0 ]),
333+ smoothstep (low [1 ], high [1 ], x [1 ]),
334+ smoothstep (low [2 ], high [2 ], x [2 ]));
335335}
336336
337- float linearstep (float edge0 , float edge1 , float x ) {
337+ float linearstep (float low , float high , float x ) {
338338 float result ;
339- if (edge0 != edge1 ) {
340- float xclamped = clamp (x , edge0 , edge1 );
341- result = (xclamped - edge0 ) / (edge1 - edge0 );
339+ if (low != high ) {
340+ float xclamped = clamp (x , low , high );
341+ result = (xclamped - low ) / (high - low );
342342 } else { // special case: edges coincide
343- result = step (edge0 , x );
343+ result = step (low , x );
344344 }
345345 return result ;
346346}
347- color linearstep (color edge0 , color edge1 , color x )
347+ color linearstep (color low , color high , color x )
348348{
349- return color (linearstep (edge0 [0 ], edge1 [0 ], x [0 ]),
350- linearstep (edge0 [1 ], edge1 [1 ], x [1 ]),
351- linearstep (edge0 [2 ], edge1 [2 ], x [2 ]));
349+ return color (linearstep (low [0 ], high [0 ], x [0 ]),
350+ linearstep (low [1 ], high [1 ], x [1 ]),
351+ linearstep (low [2 ], high [2 ], x [2 ]));
352352}
353- vector linearstep (vector edge0 , vector edge1 , vector x )
353+ vector linearstep (vector low , vector high , vector x )
354354{
355- return vector (linearstep (edge0 [0 ], edge1 [0 ], x [0 ]),
356- linearstep (edge0 [1 ], edge1 [1 ], x [1 ]),
357- linearstep (edge0 [2 ], edge1 [2 ], x [2 ]));
355+ return vector (linearstep (low [0 ], high [0 ], x [0 ]),
356+ linearstep (low [1 ], high [1 ], x [1 ]),
357+ linearstep (low [2 ], high [2 ], x [2 ]));
358358}
359359
360- float smooth_linearstep (float edge0 , float edge1 , float x_ , float eps_ ) {
360+ float smooth_linearstep (float low , float high , float x_ , float eps_ ) {
361361 float result ;
362- if (edge0 != edge1 ) {
362+ if (low != high ) {
363363 float rampup (float x , float r ) { return 0.5 /r * x * x ; }
364- float width_inv = 1.0 / (edge1 - edge0 );
364+ float width_inv = 1.0 / (high - low );
365365 float eps = eps_ * width_inv ;
366- float x = (x_ - edge0 ) * width_inv ;
366+ float x = (x_ - low ) * width_inv ;
367367 if (x <= - eps ) result = 0 ;
368368 else if (x >= eps && x <= 1.0 - eps ) result = x ;
369369 else if (x >= 1.0 + eps ) result = 1 ;
370370 else if (x < eps ) result = rampup (x + eps , 2.0 * eps );
371371 else /* if (x < 1.0+eps) */ result = 1.0 - rampup (1.0 + eps - x , 2.0 * eps );
372372 } else {
373- result = step (edge0 , x_ );
373+ result = step (low , x_ );
374374 }
375375 return result ;
376376}
377377
378- color smooth_linearstep (color edge0 , color edge1 , color x , color eps )
378+ color smooth_linearstep (color low , color high , color x , color eps )
379379{
380- return color (smooth_linearstep (edge0 [0 ], edge1 [0 ], x [0 ], eps [0 ]),
381- smooth_linearstep (edge0 [1 ], edge1 [1 ], x [1 ], eps [1 ]),
382- smooth_linearstep (edge0 [2 ], edge1 [2 ], x [2 ], eps [2 ]));
380+ return color (smooth_linearstep (low [0 ], high [0 ], x [0 ], eps [0 ]),
381+ smooth_linearstep (low [1 ], high [1 ], x [1 ], eps [1 ]),
382+ smooth_linearstep (low [2 ], high [2 ], x [2 ], eps [2 ]));
383383}
384- vector smooth_linearstep (vector edge0 , vector edge1 , vector x , vector eps )
384+ vector smooth_linearstep (vector low , vector high , vector x , vector eps )
385385{
386- return vector (smooth_linearstep (edge0 [0 ], edge1 [0 ], x [0 ], eps [0 ]),
387- smooth_linearstep (edge0 [1 ], edge1 [1 ], x [1 ], eps [1 ]),
388- smooth_linearstep (edge0 [2 ], edge1 [2 ], x [2 ], eps [2 ]));
386+ return vector (smooth_linearstep (low [0 ], high [0 ], x [0 ], eps [0 ]),
387+ smooth_linearstep (low [1 ], high [1 ], x [1 ], eps [1 ]),
388+ smooth_linearstep (low [2 ], high [2 ], x [2 ], eps [2 ]));
389389}
390390
391391float aastep (float edge , float s , float dedge , float ds ) {
0 commit comments