diff options
| author | Ray <[email protected]> | 2019-05-17 20:03:04 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-05-17 20:03:04 +0200 |
| commit | 245cf2400e3f215b998d4e1f2ae1f9afefa0eb08 (patch) | |
| tree | 15552dd041dab47c9ca23efbb4b8925c384beab2 /examples/models/resources/shaders/pbr.vs | |
| parent | 0ec46e8976f48617fe39bc10a44ff7313d6b27ea (diff) | |
| download | raylib-245cf2400e3f215b998d4e1f2ae1f9afefa0eb08.tar.gz raylib-245cf2400e3f215b998d4e1f2ae1f9afefa0eb08.zip | |
Review shader examples
Diffstat (limited to 'examples/models/resources/shaders/pbr.vs')
| -rw-r--r-- | examples/models/resources/shaders/pbr.vs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/examples/models/resources/shaders/pbr.vs b/examples/models/resources/shaders/pbr.vs deleted file mode 100644 index 8bd3faa1..00000000 --- a/examples/models/resources/shaders/pbr.vs +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************************* -* -* rPBR [shader] - Physically based rendering vertex shader -* -* Copyright (c) 2017 Victor Fisac -* -**********************************************************************************************/ - -#version 330 - -// Input vertex attributes -in vec3 vertexPosition; -in vec2 vertexTexCoord; -in vec3 vertexNormal; -in vec4 vertexTangent; - -// Input uniform values -uniform mat4 mvp; -uniform mat4 matModel; - -// Output vertex attributes (to fragment shader) -out vec3 fragPosition; -out vec2 fragTexCoord; -out vec3 fragNormal; -out vec3 fragTangent; -out vec3 fragBinormal; - -void main() -{ - // Calculate binormal from vertex normal and tangent - vec3 vertexBinormal = cross(vertexNormal, vec3(vertexTangent)); - - // Calculate fragment normal based on normal transformations - mat3 normalMatrix = transpose(inverse(mat3(matModel))); - - // Calculate fragment position based on model transformations - fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f)); - - // Send vertex attributes to fragment shader - fragTexCoord = vertexTexCoord; - fragNormal = normalize(normalMatrix*vertexNormal); - fragTangent = normalize(normalMatrix*vec3(vertexTangent)); - fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal); - fragBinormal = normalize(normalMatrix*vertexBinormal); - fragBinormal = cross(fragNormal, fragTangent); - - // Calculate final vertex position - gl_Position = mvp*vec4(vertexPosition, 1.0); -}
\ No newline at end of file |
