| 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 450 core |
| 6 |
|
| 7 |
layout(location=0) in vec3 vertexPosition; |
| 8 |
layout(location=1) in vec3 vertexNormal; |
| 9 |
layout(location=2) in vec2 vertexTexCoord; |
| 10 |
|
| 11 |
layout(location=0) out vec3 position; |
| 12 |
layout(location=1) out vec3 normal; |
| 13 |
layout(location=2) out vec2 texCoord; |
| 14 |
|
| 15 |
|
| 16 |
layout(std140, binding = 1) uniform qt3d_command_uniforms { |
| 17 |
mat4 modelMatrix; |
| 18 |
mat4 inverseModelMatrix; |
| 19 |
mat4 modelViewMatrix; |
| 20 |
mat3 modelNormalMatrix; |
| 21 |
mat4 inverseModelViewMatrix; |
| 22 |
mat4 modelViewProjection; |
| 23 |
mat4 inverseModelViewProjectionMatrix; |
| 24 |
}; |
| 25 |
|
| 26 |
layout(std140, binding = 2) uniform extras_uniforms { |
| 27 |
float texCoordScale; |
| 28 |
vec3 ka; // Ambient reflectivity |
| 29 |
vec3 ks; // Specular reflectivity |
| 30 |
float shininess; // Specular shininess factor |
| 31 |
float opacity; // Alpha channel |
| 32 |
vec3 lightPosition; |
| 33 |
vec3 lightIntensity; |
| 34 |
}; |
| 35 |
|
| 36 |
void main() |
| 37 |
{ |
| 38 |
texCoord = vertexTexCoord * texCoordScale; |
| 39 |
normal = normalize(modelNormalMatrix * vertexNormal); |
| 40 |
position = vec3(modelViewMatrix * vec4(vertexPosition, 1.0)); |
| 41 |
|
| 42 |
gl_Position = modelViewProjection * vec4(vertexPosition, 1.0); |
| 43 |
} |