Renamed matrices. I quite like names such as 'modelToWorldMatrix' and 'cameraToClipMatrix' because they were very explicit about what the transform was doing. However OpenGL uses common terms such as 'model matrix' and 'projection matrix', so other people wlil be able to follow the code more easily if we stick to these conventions.

This commit is contained in:
David Williams
2015-02-24 16:08:55 +01:00
parent 7262ca313e
commit 9547824f14
7 changed files with 51 additions and 51 deletions

View File

@ -4,9 +4,9 @@ in uvec4 position; // This will be the position of the vertex in model-space
in uint normal;
// The usual matrices are provided
uniform mat4 cameraToClipMatrix;
uniform mat4 worldToCameraMatrix;
uniform mat4 modelToWorldMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
// 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.
@ -40,7 +40,7 @@ void main()
worldNormal.w = 1.0;
// Standard sequence of OpenGL transformations.
worldPosition = modelToWorldMatrix * decodedPosition;
vec4 cameraPosition = worldToCameraMatrix * worldPosition;
gl_Position = cameraToClipMatrix * cameraPosition;
worldPosition = modelMatrix * decodedPosition;
vec4 cameraPosition = viewMatrix * worldPosition;
gl_Position = projectionMatrix * cameraPosition;
}