bialylis / ThickRedLine

Thick Red Line - drawing thick lines for SceneKit with metal shaders

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ThickRedLine

Thick Red Line - drawing thick lines with constant on-screen width independent of perspective, for SceneKit with metal shaders

Example:

let geometry = SCNGeometry.lineThrough(points: [SCNVector3(0, 0,0), SCNVector3(0, 10, 0), SCNVector3(10, 10, 0)],
                                       width: 20,
                                       closed: false,
                                       color: UIColor.red.cgColor)
let node = SCNNode(geometry: geometry)
scene.rootNode.addChildNode(node)

Thick line gif

Parameters:

  • points - array of SCNVector3 indicating points on the line
  • width - (int) width of line in points
  • closed - (bool) if line should for a loop
  • color - (CGColor) color of the line
  • mitter - (bool) if line should form a sharp mitter at the joints. Feature is WIP - not supported with closed (the first and last joint will not be mittered) and there are artefacts when angle between the lines is too small

img1 img2 img3

About

Thick Red Line - drawing thick lines for SceneKit with metal shaders

License:MIT License


Languages

Language:Metal 70.9%Language:Swift 29.1%