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

gpencil_stroke_vert.glsl « shaders « gpencil « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f9a105e9113e1d8c57337aa2cd47a7ef6bc6880 (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 mat4 ProjectionMatrix;

uniform float pixsize;   /* rv3d->pixsize */
uniform float pixelsize; /* U.pixelsize */
uniform int keep_size;
uniform float objscale;
uniform float pixfactor;

in vec3 pos;
in vec4 color;
in float thickness;
in vec2 uvdata;

out vec4 finalColor;
out float finalThickness;
out vec2 finaluvdata;

#define TRUE 1

float defaultpixsize = pixsize * pixelsize * (1000.0 / pixfactor);

void main(void)
{
	gl_Position = ModelViewProjectionMatrix * vec4( pos, 1.0 );
	finalColor = color;

	if (keep_size == TRUE) {
		finalThickness = thickness;
	}
	else {
		float size = (ProjectionMatrix[3][3] == 0.0) ? (thickness / (gl_Position.z * defaultpixsize)) : (thickness / defaultpixsize);
		finalThickness = max(size * objscale, 1.0);
	}

	finaluvdata = uvdata;
}