glsl infinity constant

前端 未结 3 492
深忆病人
深忆病人 2021-01-07 22:26

Does GLSL have any pre-defined constants for +/-infinity or NaN? I\'m doing this as a workaround but I wonder if there is a cleaner way:

// GLSL FRAGMENT SHA         


        
3条回答
  •  甜味超标
    2021-01-07 23:12

    This might work?

    const float pos_infinity = uintBitsToFloat(0x7F800000);
    const float neg_infinity = uintBitsToFloat(0xFF800000);
    

    "If the encoding of a floating point infinity is passed in parameter x, the resulting floating-point value is the corresponding (positive or negative) floating point infinity"

提交回复
热议问题