Debian Codegraph @

tests/manual/shadow-map-qml/shaders/ads.vert

raw
1 // Copyright (C) 2014 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
9 out vec4 positionInLightSpace;
10 out vec3 position;
11 out vec3 normal;
12
13 uniform mat4 lightViewProjection;
14 uniform mat4 modelMatrix;
15 uniform mat4 modelView;
16 uniform mat3 modelViewNormal;
17 uniform mat4 mvp;
18
19 void main()
20 {
21 // positionInLightSpace = lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
22 const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0,
23 0.0, 0.5, 0.0, 0.0,
24 0.0, 0.0, 0.5, 0.0,
25 0.5, 0.5, 0.5, 1.0);
26
27 positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
28
29 normal = normalize(modelViewNormal * vertexNormal);
30 position = vec3(modelView * vec4(vertexPosition, 1.0));
31
32 gl_Position = mvp * vec4(vertexPosition, 1.0);
33 }