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:
@ -4,9 +4,9 @@ in vec4 position; // This will be the position of the vertex in model-space
|
||||
in vec4 normal; // The normal data may not have been set
|
||||
in ivec2 material;
|
||||
|
||||
uniform mat4 cameraToClipMatrix;
|
||||
uniform mat4 worldToCameraMatrix;
|
||||
uniform mat4 modelToWorldMatrix;
|
||||
uniform mat4 projectionMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
|
||||
out vec4 worldPosition; //This is being passed to the fragment shader to calculate the normals
|
||||
out vec3 normalFromVS;
|
||||
@ -15,7 +15,7 @@ flat out ivec2 materialFromVS;
|
||||
void main()
|
||||
{
|
||||
// Compute the usual OpenGL transformation to clip space.
|
||||
gl_Position = cameraToClipMatrix * worldToCameraMatrix * modelToWorldMatrix * position;
|
||||
gl_Position = projectionMatrix * viewMatrix * modelMatrix * position;
|
||||
|
||||
// This example is demonstrating the marching cubes mesh, which does have per-vertex normals. We can
|
||||
// just pass them through, though real code might want to deal with transforming normals appropriatly.
|
||||
|
Reference in New Issue
Block a user