Debian Codegraph @

tests/manual/planets-qml/shaders/gl3/planetDShadow.vert

raw
1 // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2 // Copyright (C) 2017 The Qt Company Ltd.
3 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5 #version 150 core
6
7 in vec3 vertexPosition;
8 in vec3 vertexNormal;
9 in vec2 vertexTexCoord;
10
11 out vec4 positionInLightSpace;
12 out vec3 position;
13 out vec3 normal;
14 out vec2 texCoord;
15
16 uniform mat4 lightViewProjection;
17 uniform mat4 modelMatrix;
18 uniform mat4 modelView;
19 uniform mat3 modelViewNormal;
20 uniform mat4 mvp;
21
22 uniform float texCoordScale;
23
24 void main()
25 {
26 const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0,
27 0.0, 0.5, 0.0, 0.0,
28 0.0, 0.0, 0.5, 0.0,
29 0.5, 0.5, 0.5, 1.0);
30
31 positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
32
33 texCoord = vertexTexCoord * texCoordScale;
34 normal = normalize(modelViewNormal * vertexNormal);
35 position = vec3(modelView * vec4(vertexPosition, 1.0));
36
37 gl_Position = mvp * vec4(vertexPosition, 1.0);
38 }