Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit c6ae38c

Browse files
committed
Sample texture in shaders
1 parent 9936670 commit c6ae38c

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

Assets/Shaders/Default.frag

280 Bytes
Binary file not shown.

Assets/Shaders/Default.vert

96 Bytes
Binary file not shown.

Lib/Src/Glsl/Default.frag

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#version 450 core
22

3+
layout (set = 0, binding = 2) uniform sampler2D tex;
4+
35
layout (location = 0) in vec4 inColour;
6+
layout (location = 1) in vec2 inUv;
47

58
layout (location = 0) out vec4 outColour;
69

710
void main()
811
{
9-
outColour = inColour;
12+
outColour = inColour * texture(tex, inUv);
1013
}

Lib/Src/Glsl/Default.vert

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ layout (set = 0, binding = 1) readonly buffer Instances
2121
};
2222

2323
layout (location = 0) out vec4 outColour;
24+
layout (location = 1) out vec2 outUv;
2425

2526
void main()
2627
{
@@ -29,6 +30,7 @@ void main()
2930
const vec4 worldPos = instance.model * vec4(aPos, 0.0, 1.0);
3031

3132
outColour = aColour * instance.tint;
33+
outUv = aUv;
3234

3335
gl_Position = matVP * worldPos;
3436
}

0 commit comments

Comments
 (0)