Debian Codegraph @

src/extras/shaders/rhi/default_pos_norm_tex.vert

raw
1 // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4 #version 450
5
6 layout(location = 0) in vec3 vertexPosition;
7 layout(location = 1) in vec3 vertexNormal;
8 layout(location = 3) in vec2 vertexTexCoord;
9
10 layout(location = 0) out vec3 worldPosition;
11 layout(location = 1) out vec3 worldNormal;
12 layout(location = 3) out vec2 texCoord;
13
14 layout(std140, binding = 0) uniform qt3d_render_view_uniforms {
15 mat4 viewMatrix;
16 mat4 projectionMatrix;
17 mat4 viewProjectionMatrix;
18 mat4 inverseViewMatrix;
19 mat4 inverseProjectionMatrix;
20 mat4 inverseViewProjectionMatrix;
21 mat4 viewportMatrix;
22 mat4 inverseViewportMatrix;
23 vec4 textureTransformMatrix;
24 vec3 eyePosition;
25 float aspectRatio;
26 float gamma;
27 float exposure;
28 float time;
29 };
30
31 layout(std140, binding = 1) uniform qt3d_command_uniforms {
32 mat4 modelMatrix;
33 mat4 inverseModelMatrix;
34 mat4 modelViewMatrix;
35 mat3 modelNormalMatrix;
36 mat4 inverseModelViewMatrix;
37 mat4 modelViewProjection;
38 mat4 inverseModelViewProjectionMatrix;
39 };
40
41 layout(std140, binding = 2) uniform qt3d_extras_uniforms {
42 float texCoordScale;
43 };
44
45 void main()
46 {
47 // Pass through scaled texture coordinates
48 texCoord = vertexTexCoord * texCoordScale;
49
50 // Transform position, normal, and tangent to world space
51 worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0));
52 worldNormal = normalize(modelNormalMatrix * vertexNormal);
53
54 // Calculate vertex position in clip coordinates
55 gl_Position = modelViewProjection * vec4(vertexPosition, 1.0);
56 }