Pass the normal matrix through and multiply the normal by it

This commit is contained in:
Eryn Wells 2018-11-20 11:24:28 -07:00
parent e99cd03446
commit 952204a5b6
2 changed files with 6 additions and 9 deletions

View file

@ -33,18 +33,12 @@ typedef struct
#pragma mark - Geometry Shaders
vertex ColorInOut vertexShader(Vertex in [[stage_in]],
texture2d<float> heights [[texture(0)]],
constant Uniforms & uniforms [[buffer(BufferIndexUniforms)]])
constant Uniforms &uniforms [[buffer(BufferIndexUniforms)]])
{
// constexpr sampler s(coord::normalized, address::clamp_to_zero, filter::linear);
ColorInOut out;
// float4 height = heights.sample(s, in.texCoord);
// Replace the y coordinate with the height we read from the texture.
out.position = uniforms.projectionMatrix * uniforms.modelViewMatrix * float4(in.position, 1.0);
out.normal = in.normal;
out.normal = uniforms.normalMatrix * in.normal;
out.texCoord = in.texCoord;
return out;