How/where does Qt3d assign default values to shader uniforms?

Viewed 227

In Qt's Qt 3D Wireframe QML example, the vertex shader code looks as follows:

#version 330 core

in vec3 vertexPosition;
in vec3 vertexNormal;

out EyeSpaceVertex {
    vec3 position;
    vec3 normal;
} vs_out;

uniform mat4 modelView;
uniform mat3 modelViewNormal;
uniform mat4 mvp;

void main()
{
    vs_out.normal = normalize( modelViewNormal * vertexNormal );
    vs_out.position = vec3( modelView * vec4( vertexPosition, 1.0 ) );

    gl_Position = mvp * vec4( vertexPosition, 1.0 );
}

None of the uniform variables above are initialized in the example's source code, so they must receive default values as explained in the doc for ShaderProgram, which states:

Qt3D will automatically populate a set of default uniforms if they are encountered during the shader instrospection phase.

The list of "default uniforms" is given as well.

I tried to find the part in the Qt source code where these uniforms are assigned their default values (which I guess are identity matrices), but couldn't somehow. Any ideas?

1 Answers
Related