我有这样的功能:
func getdrawnHorLineFrom(pos1: SCNVector3, toPos2: SCNVector3) -> SCNNode {
let obj1 = SCNVector3(x: toPos2.x, y: toPos2.y, z:pos1.z)
let line = lineFrom(vector: pos1, toVector: obj1)
let lineInBetween1 = SCNNode(geometry: line)
glLineWidth(15)
return lineInBetween1
}
Run Code Online (Sandbox Code Playgroud)
还:
func lineFrom(vector vector1: SCNVector3, toVector vector2: SCNVector3) -> SCNGeometry {
let indices: [Int32] = [0, 1]
let source = SCNGeometrySource(vertices: [vector1, vector2])
let element = SCNGeometryElement(indices: indices, primitiveType: .line)
return SCNGeometry(sources: [source], elements: [element])
}
Run Code Online (Sandbox Code Playgroud)
基本上,我试图在两个 SCNVector3 类型的 3D 点之间画一条线。绘制的线是一个带有primitiveType 'line' 的'SCNGeometry'。
现在,我想增加我的线条粗细,使其看起来清晰。另外,我想知道,如果有任何办法,我可以让我的线条显示为“虚线”。我为了增加线条的粗细尝试使用 'glLineWidth() 等,但没有成功。
如果有人可以帮助我,我会很高兴。
提前致谢!
| 归档时间: |
|
| 查看次数: |
1109 次 |
| 最近记录: |