This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_vert.glsl
Jeroen Bakker 9d3f35a0bf Revert "Revert "GPUShaderCreateInfo for interface abstraction""
This reverts commit edee5a947b.

Fixes compilation error (Missing file BLI_float2.hh)
2022-01-17 14:46:32 +01:00

34 lines
899 B
GLSL

#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);
}
}