Move shader code to external files rather than embedded

A bit of CMake code in each example copies the files to the
correct location and Qt loads them from the application's binary
directory.
This commit is contained in:
Matt Williams
2014-05-27 15:08:20 +01:00
parent 1d8fc25cb7
commit 140cbc0fc7
7 changed files with 54 additions and 43 deletions

View File

@ -0,0 +1,20 @@
#version 140
in vec4 position; // This will be the position of the vertex in model-space
// The usual matrices are provided
uniform mat4 cameraToClipMatrix;
uniform mat4 worldToCameraMatrix;
uniform mat4 modelToWorldMatrix;
// This will be used by the fragment shader to calculate flat-shaded normals. This is an unconventional approach
// but we use it in this example framework because not all surface extractor generate surface normals.
out vec4 worldPosition;
void main()
{
// Standard sequence of OpenGL transformations.
worldPosition = modelToWorldMatrix * position;
vec4 cameraPosition = worldToCameraMatrix * worldPosition;
gl_Position = cameraToClipMatrix * cameraPosition;
}