diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2019-04-24 04:17:16 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2019-04-24 04:17:16 +0200 |
| commit | 2d2e2ff4038db052d0186645f5afe4ec9daf2505 (patch) | |
| tree | d8491d9921381ec5d4149fdc014b72e375199dab /samples/Pbr/shaders/pbr.vert | |
| parent | 25fc1c7019142137dc67e4fad0c3088d845ab0a8 (diff) | |
use boolean for tex0 and tex1 availability tests
Diffstat (limited to 'samples/Pbr/shaders/pbr.vert')
| -rw-r--r-- | samples/Pbr/shaders/pbr.vert | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/samples/Pbr/shaders/pbr.vert b/samples/Pbr/shaders/pbr.vert deleted file mode 100644 index 03d24da..0000000 --- a/samples/Pbr/shaders/pbr.vert +++ /dev/null @@ -1,58 +0,0 @@ -#version 450 - -layout (location = 0) in vec3 inPos; -layout (location = 1) in vec3 inNormal; -layout (location = 2) in vec2 inUV0; -layout (location = 3) in vec2 inUV1; -layout (location = 4) in vec4 inJoint0; -layout (location = 5) in vec4 inWeight0; - -layout (set = 0, binding = 0) uniform UBO -{ - mat4 projection; - mat4 model; - mat4 view; - vec3 camPos; -} ubo; - -#define MAX_NUM_JOINTS 128 - -layout (set = 2, binding = 0) uniform UBONode { - mat4 matrix; - mat4 jointMatrix[MAX_NUM_JOINTS]; - float jointCount; -} node; - -layout (location = 0) out vec3 outWorldPos; -layout (location = 1) out vec3 outNormal; -layout (location = 2) out vec2 outUV0; -layout (location = 3) out vec2 outUV1; - -out gl_PerVertex -{ - vec4 gl_Position; -}; - -void main() -{ - vec4 locPos; - if (node.jointCount > 0.0) { - // Mesh is skinned - mat4 skinMat = - inWeight0.x * node.jointMatrix[int(inJoint0.x)] + - inWeight0.y * node.jointMatrix[int(inJoint0.y)] + - inWeight0.z * node.jointMatrix[int(inJoint0.z)] + - inWeight0.w * node.jointMatrix[int(inJoint0.w)]; - - locPos = ubo.model * node.matrix * skinMat * vec4(inPos, 1.0); - outNormal = normalize(transpose(inverse(mat3(ubo.model * node.matrix * skinMat))) * inNormal); - } else { - locPos = ubo.model * node.matrix * vec4(inPos, 1.0); - outNormal = normalize(transpose(inverse(mat3(ubo.model * node.matrix))) * inNormal); - } - locPos.y = -locPos.y; - outWorldPos = locPos.xyz / locPos.w; - outUV0 = inUV0; - outUV1 = inUV1; - gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0); -} |