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

gpu_shader_gpencil_stroke_vert.glsl « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 16e12b2989e8c8494ab3385839ec3c12206a17a8 (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
#ifndef USE_GPU_SHADER_CREATE_INFO
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ProjectionMatrix;

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

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

out vec4 finalColor;
out float finalThickness;
#endif

float defaultpixsize = gpencil_stroke_data.pixsize * (1000.0 / gpencil_stroke_data.pixfactor);

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

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