Search code examples
glslshaderrenderhlslcg

What dose 1.-1 mean in all shader language


I saw glsl code like this:

vec3 color = vec3(.0);
float var = 0;
color += 1.-step(0.2,var);

What does color += 1.-step(0.2,var) mean, I found it also work for cg language.And it has other form: 1.-1, 1.-0, etc

Is .- a operator?


Solution

  • There is no .- operator. 1. is a floating point literal (1.0). So 1.-step(0.2,var) is exactly the same as 1.0 - step(0.2,var). .0 is the same as 0.0.

    See OpenGL Shading Language 4.60 Specification- 4.1.4. Floats