Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gpu_shader_2D_area_borders_vert.glsl « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 816e12342a139907bb289214ba47dd6d7aee3291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

uniform mat4 ModelViewProjectionMatrix;

uniform vec4 rect;
uniform int cornerLen;
uniform float scale;

in vec2 pos;

out vec2 uv;


void main()
{
	int corner_id = (gl_VertexID / cornerLen) % 4;

	vec2 final_pos = pos * scale;

	if (corner_id == 0) {
		uv = pos + vec2(1.0, 1.0);
		final_pos += rect.yw;  /* top right */
	}
	else if (corner_id == 1) {
		uv = pos + vec2(-1.0, 1.0);
		final_pos += rect.xw;  /* top left */
	}
	else if (corner_id == 2) {
		uv = pos + vec2(-1.0, -1.0);
		final_pos += rect.xz;  /* bottom left */
	}
	else {
		uv = pos + vec2(1.0, -1.0);
		final_pos += rect.yz;  /* bottom right */
	}

	gl_Position = (ModelViewProjectionMatrix * vec4(final_pos, 0.0, 1.0));
}