Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl
| #define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */ | #define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */ | ||||
| /** | /** | ||||
| * We want to know how much a pixel is covered by a line. | * We want to know how much a pixel is covered by a line. | ||||
| * We replace the square pixel with acircle of the same area and try to find the intersection area. | * We replace the square pixel with acircle of the same area and try to find the intersection area. | ||||
| * The area we search is the circular segment. https://en.wikipedia.org/wiki/Circular_segment | * The area we search is the circular segment. https://en.wikipedia.org/wiki/Circular_segment | ||||
| * The formula for the area uses inverse trig function and is quite complexe. | * The formula for the area uses inverse trig function and is quite complexe. | ||||
| * Instead, we approximate it by using the smoothstep function and a 1.05 factor to the disc radius. | * Instead, we approximate it by using the smoothstep function and a 1.05 factor to the disc radius. | ||||
| **/ | */ | ||||
| #define DISC_RADIUS (M_1_SQRTPI * 1.05) | #define DISC_RADIUS (M_1_SQRTPI * 1.05) | ||||
| #define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS) | #define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS) | ||||
| #define GRID_LINE_SMOOTH_END (0.5 + DISC_RADIUS) | #define GRID_LINE_SMOOTH_END (0.5 + DISC_RADIUS) | ||||
| uniform float edgeScale; | uniform float edgeScale; | ||||
| flat in vec4 finalColorOuter_f; | flat in vec4 finalColorOuter_f; | ||||
| in vec4 finalColor_f; | in vec4 finalColor_f; | ||||
| Show All 18 Lines | |||||