Found a nice way to extrude this barrier mesh with miter corners in the vertex shader :)
Extrude along the X axis. The vertex local X is used as the interpolant, before multiplying with the model matrix.
pos.x = mix(end0 + tan(angle0) * pos.y, end1 + tan(angle1) * pos.y, pos.x); #gamedev #indiedev
Extrude along the X axis. The vertex local X is used as the interpolant, before multiplying with the model matrix.
pos.x = mix(end0 + tan(angle0) * pos.y, end1 + tan(angle1) * pos.y, pos.x); #gamedev #indiedev
Comments
`+ tan(angle) * pos.y`
Is what produces the miter corners. You just have to figure out `angle` on the CPU