Fix line width calculation
It was only correct at the screen center
This commit is contained in:
parent
f162a18107
commit
32a2995e7b
|
|
@ -48,7 +48,8 @@ fn vs_main(seg: SegmentInput, off: OffsetInput) -> VertexOutput {
|
|||
default: {}
|
||||
}
|
||||
let pt_cs = camera.mvp * vec4(pt, 1.);
|
||||
let dir_cs = camera.mvp * vec4(dir, 0.);
|
||||
let dir_cs0 = camera.mvp * vec4(dir, 0.);
|
||||
let dir_cs = dir_cs0.xyz * pt_cs.w - pt_cs.xyz * dir_cs0.w;
|
||||
let normal_cs = camera.scale * normalize(vec2(-dir_cs.y, dir_cs.x));
|
||||
out.clip_position = pt_cs + vec4(sgn * width * normal_cs, 0., 0.);
|
||||
return out;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user