首页 > 解决方案 > 在 Arkit SceneView 中增加线条的粗细

问题描述

我有这样的功能:

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  
}

还:

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])
}

基本上,我试图在两个 SCNVector3 类型的 3D 点之间画一条线。绘制的线是具有原始类型“线”的“SCNGeometry”。

现在,我想增加我的线条粗细,使它看起来清晰。另外,我想知道,如果有什么办法,我可以让我的线显示为“虚线”。我为了增加线条的粗细尝试使用 'glLineWidth() 等,但没有成功。

如果有人可以帮助我,我会很高兴。

提前致谢!

标签: iosswiftarkit

解决方案


推荐阅读