Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #shader vertex
- #version 150 core
- in vec4 position;
- in vec2 texcoord;
- uniform mat4 u_mvp;
- struct v2f {
- vec2 texcoord;
- };
- out v2f _v2f;
- void main()
- {
- _v2f.texcoord = texcoord;
- gl_Position = u_mvp * position;
- }
- #shader fragment
- #version 150 core
- struct v2f {
- vec2 texcoord;
- };
- in v2f _v2f;
- struct material {
- sampler2D mainTex;
- vec2 offset;
- vec4 tint;
- float alpha;
- };
- uniform material u_mat;
- out vec4 outColor;
- void main()
- {
- outColor = texture(u_mat.mainTex, _v2f.texcoord - u_mat.offset) * u_mat.tint * vec4(1, 1, 1, u_mat.alpha);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement