diff options
Diffstat (limited to 'tests/manual/planets-qml/shaders/es2/planetD.vert')
-rw-r--r-- | tests/manual/planets-qml/shaders/es2/planetD.vert | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/manual/planets-qml/shaders/es2/planetD.vert b/tests/manual/planets-qml/shaders/es2/planetD.vert new file mode 100644 index 000000000..a5da1441e --- /dev/null +++ b/tests/manual/planets-qml/shaders/es2/planetD.vert @@ -0,0 +1,36 @@ +// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +attribute vec3 vertexPosition; +attribute vec3 vertexNormal; +attribute vec2 vertexTexCoord; + +varying vec4 positionInLightSpace; +varying vec3 position; +varying vec3 normal; +varying vec2 texCoord; + +uniform mat4 lightViewProjection; +uniform mat4 modelMatrix; +uniform mat4 modelView; +uniform mat3 modelViewNormal; +uniform mat4 mvp; + +uniform float texCoordScale; + +void main() +{ + const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0, + 0.0, 0.5, 0.0, 0.0, + 0.0, 0.0, 0.5, 0.0, + 0.5, 0.5, 0.5, 1.0); + + positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0); + + texCoord = vertexTexCoord * texCoordScale; + normal = normalize(modelViewNormal * vertexNormal); + position = vec3(modelView * vec4(vertexPosition, 1.0)); + + gl_Position = mvp * vec4(vertexPosition, 1.0); +} |