genType abs (genType x) |
返回x的绝对值 |
genType sign (genType x) |
如果x>0,返回1.0;如果x=0,返回0,如果x<0,返回-1.0 |
genType floor (genType x) |
返回小于等于x的最大整数值 |
genType ceil (genType x) |
返回大于等于x的最小整数值 |
genType fract (genType x) |
返回x-floor(x),即返回x的小数部分 |
genType mod (genType x, float y)、genType mod (genType x, genType y) |
返回x – y * floor (x/y),即求模计算% |
genType min (genType x, genType y),genType min (genType x, float y) |
返回x和y的值较小的那个值 |
genType max (genType x, genType y),genType max (genType x, float y) |
返回x和y的值较大的那个值 |
genType clamp (genType x, genType minVal, genType maxVal)、genType clamp (genType x, float minVal, float maxVal) |
clamp实际上是获得三个参数中大小处在中间的那个值。函数有个说明:如果minVal > minMax的话,函数返回的结果是未定的。也就是说x的值大小没有限制,但是minval的值必须比maxVal小。 |
genType mix (genType x, genType y, genType a)、genType mix (genType x, genType y, float a) |
返回线性混合的x和y,如:x⋅(1−a)+y⋅a |
genType step (genType edge, genType x),genType step (float edge, genType x) |
如果x < edge,返回0.0,否则返回1.0 |
genType smoothstep (genType edge0,genType edge1,genType x),genType smoothstep (float edge0,float edge1,genType x) |
如果x <= edge0,返回0.0 ;如果x >= edge1 返回1.0;如果edge0 < x < edge1,则执行0~1之间的平滑埃尔米特差值。如果edge0 >= edge1,结果是未定义的。 |