Debian Codegraph @

tests/manual/clip-planes-qml/default.vert

raw
1 // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #version 150 core
5
6 in vec3 vertexPosition;
7 in vec3 vertexNormal;
8 in vec4 vertexTangent;
9 in vec2 vertexTexCoord;
10
11 out vec3 worldPosition;
12 out vec3 worldNormal;
13 out vec4 worldTangent;
14 out vec2 texCoord;
15
16 uniform mat4 modelMatrix;
17 uniform mat3 modelNormalMatrix;
18 uniform mat4 modelViewProjection;
19
20 uniform float texCoordScale;
21
22 void main()
23 {
24 // Pass through scaled texture coordinates
25 texCoord = vertexTexCoord * texCoordScale;
26
27 // Transform position, normal, and tangent to world space
28 worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0));
29 worldNormal = normalize(modelNormalMatrix * vertexNormal);
30 worldTangent.xyz = normalize(vec3(modelMatrix * vec4(vertexTangent.xyz, 0.0)));
31 worldTangent.w = vertexTangent.w;
32
33 // Calculate vertex position in clip coordinates
34 gl_Position = modelViewProjection * vec4(vertexPosition, 1.0);
35 }