blob: 7b7408964f2383369ad8e88733707fccfea66e67 (
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
|
#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl)
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
bool is_select = (nor.w > 0.0);
bool is_hidden = (nor.w < 0.0);
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
/* Add offset in Z to avoid Z-fighting and render selected wires on top. */
/* TODO: scale this bias using Z-near and Z-far range. */
gl_Position.z -= (is_select ? 2e-4 : 1e-4);
if (is_hidden) {
gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);
}
finalColor = (is_select) ? vec4(1.0) : colorWire;
finalColor.a = nor.w;
gl_PointSize = sizeVertex * 2.0;
view_clipping_distances(world_pos);
}
|