Debian Codegraph @

tests/manual/planets-qml/shaders/es2/planetD.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 attribute vec3 vertexPosition;
6 attribute vec3 vertexNormal;
7 attribute vec2 vertexTexCoord;
8
9 varying vec4 positionInLightSpace;
10 varying vec3 position;
11 varying vec3 normal;
12 varying vec2 texCoord;
13
14 uniform mat4 lightViewProjection;
15 uniform mat4 modelMatrix;
16 uniform mat4 modelView;
17 uniform mat3 modelViewNormal;
18 uniform mat4 mvp;
19
20 uniform float texCoordScale;
21
22 void main()
23 {
24 const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0,
25 0.0, 0.5, 0.0, 0.0,
26 0.0, 0.0, 0.5, 0.0,
27 0.5, 0.5, 0.5, 1.0);
28
29 positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
30
31 texCoord = vertexTexCoord * texCoordScale;
32 normal = normalize(modelViewNormal * vertexNormal);
33 position = vec3(modelView * vec4(vertexPosition, 1.0));
34
35 gl_Position = mvp * vec4(vertexPosition, 1.0);
36 }