Warning, /utilities/atelier/src/widgets/3dview/axisgnomon.vert is written in an unsupported language. File is not indexed.

0001 /* Atelier KDE Printer Host for 3D Printing
0002     Copyright (C) <2018>
0003     Author: Kevin Ottens - ervin@kde.org
0004 
0005     This program is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU General Public License as
0007     published by the Free Software Foundation; either version 3 of
0008     the License or any later version accepted by the membership of
0009     KDE e.V. (or its successor approved by the membership of KDE
0010     e.V.), which shall act as a proxy defined in Section 14 of
0011     version 3 of the license.
0012 
0013     This program is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016     GNU General Public License for more details.
0017 
0018     You should have received a copy of the GNU General Public License
0019     along with this program.  If not, see <http://www.gnu.org/licenses/>.
0020 */
0021 
0022 #version 150 core
0023 
0024 in vec3 vertexPosition;
0025 in vec3 vertexNormal;
0026 in vec4 vertexColor;
0027 
0028 out vec3 worldPosition;
0029 out vec3 worldNormal;
0030 out vec4 color;
0031 
0032 uniform mat4 modelMatrix;
0033 uniform mat3 modelNormalMatrix;
0034 uniform mat4 inverseViewMatrix;
0035 
0036 uniform float aspectRatio;
0037 
0038 uniform mat4 axisGnomonModelMatrix;
0039 uniform mat4 axisGnomonProjectionMatrix;
0040 
0041 void main()
0042 {
0043     worldNormal = normalize(modelNormalMatrix * vertexNormal);
0044     worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0));
0045     color = vertexColor;
0046 
0047     mat4 projectionMatrix = axisGnomonProjectionMatrix;
0048     projectionMatrix[0][0] = projectionMatrix[0][0] / aspectRatio;
0049     projectionMatrix[0][3] = projectionMatrix[0][3] / aspectRatio;
0050 
0051     mat4 viewRotation = mat4(transpose(mat3(inverseViewMatrix)));
0052     mat4 mvp = projectionMatrix * axisGnomonModelMatrix * viewRotation;
0053     gl_Position = mvp * vec4(vertexPosition, 1.0);
0054 }