Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl
| Show All 11 Lines | vec2 screen_position(vec4 p) | ||||
| return ((p.xy / p.w) * 0.5 + 0.5) * sizeViewport.xy; | return ((p.xy / p.w) * 0.5 + 0.5) * sizeViewport.xy; | ||||
| } | } | ||||
| void main() | void main() | ||||
| { | { | ||||
| vec3 world_pos = point_object_to_world(pos); | vec3 world_pos = point_object_to_world(pos); | ||||
| gl_Position = point_world_to_ndc(world_pos); | gl_Position = point_world_to_ndc(world_pos); | ||||
| #ifdef SELECT_EDGES | |||||
| /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the | /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the | ||||
| * wire to at least create one fragment that will pass the occlusion query. */ | * wire to at least create one fragment that will pass the occlusion query. */ | ||||
| /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */ | /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */ | ||||
| gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); | gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); | ||||
| #endif | |||||
| stipple_coord = stipple_start = screen_position(gl_Position); | stipple_coord = stipple_start = screen_position(gl_Position); | ||||
| #ifdef OBJECT_WIRE | #ifdef OBJECT_WIRE | ||||
| /* Extract data packed inside the unused mat4 members. */ | /* Extract data packed inside the unused mat4 members. */ | ||||
| finalColor = vec4(ModelMatrix[0][3], ModelMatrix[1][3], ModelMatrix[2][3], ModelMatrix[3][3]); | finalColor = vec4(ModelMatrix[0][3], ModelMatrix[1][3], ModelMatrix[2][3], ModelMatrix[3][3]); | ||||
| #else | #else | ||||
| if (colorid == TH_CAMERA_PATH) { | if (colorid == TH_CAMERA_PATH) { | ||||
| finalColor = colorCameraPath; | finalColor = colorCameraPath; | ||||
| finalColor.a = 0.0; /* No Stipple */ | finalColor.a = 0.0; /* No Stipple */ | ||||
| } | } | ||||
| else { | else { | ||||
| finalColor = color; | finalColor = color; | ||||
| finalColor.a = 1.0; /* Stipple */ | finalColor.a = 1.0; /* Stipple */ | ||||
| } | } | ||||
| #endif | #endif | ||||
| #ifdef SELECT_EDGES | |||||
| finalColor.a = 0.0; /* No Stipple */ | |||||
| #endif | |||||
| #ifdef USE_WORLD_CLIP_PLANES | #ifdef USE_WORLD_CLIP_PLANES | ||||
| world_clip_planes_calc_clip_distance(world_pos); | world_clip_planes_calc_clip_distance(world_pos); | ||||
| #endif | #endif | ||||
| } | } | ||||