SCNBox

作者: AntKing | 来源:发表于2020-08-21 11:35 被阅读0次
class SCNBox : SCNGeometry

六面多面体几何,其面均为矩形,可以选择带有圆角和圆角。

通过设置框的宽度,高度和长度属性,在其局部坐标空间的x,y和z轴尺寸中定义框的形状。 使用其chamferRadius属性将圆角和圆角添加到框。 要在场景中定位和定向盒子,请将其附加到SCNNode对象的geometry属性。

使用widthSegmentCount,heightSegmentCount,lengthSegmentCount和chamferSegmentCount属性控制细节级别。 较高的细分数量会产生更多的顶点,这可以提高某些照明模型或自定义着色器效果的渲染质量,但会降低渲染性能。

您可以通过其物料属性将最多六个SCNMaterial实例分配给一个框(每个侧面一个)。 SCNBox类根据需要自动创建SCNGeometryElement对象,以处理多种材料。

convenience init(width: CGFloat, height: CGFloat, length: CGFloat, chamferRadius: CGFloat)

Creates a box geometry with the specified width, height, length, and chamfer radius.
使用指定宽,高,长,圆角,初始化
var width: CGFloat { get set }
The extent of the box along its x-axis. Animatable.
x轴上的宽
var height: CGFloat { get set }
The extent of the box along its y-axis. Animatable.
y轴上的高
var length: CGFloat { get set }
The extent of the box along its z-axis. Animatable.
z轴上的长
var widthSegmentCount: Int { get set }
The number of subdivisions in each face of the box along its x-axis. Animatable.

x轴方向上的面的小的分段数
增加分段数,会消耗渲染性能,默认值1
var heightSegmentCount: Int { get set }
The number of subdivisions in each face of the box along its y-axis. Animatable.
y轴上的面的小分段数,
增加分段数,会消耗渲染性能,默认值1
var lengthSegmentCount: Int { get set }
The number of subdivisions in each face of the box along its z-axis. Animatable.
z轴上的面的分段数
增加分段数,会消耗渲染性能,默认值1
var chamferRadius: CGFloat { get set }
The radius of curvature for the edges and corners of the box. Animatable.
盒子的边缘和圆角的曲率半径
默认值是0, 设置一个大于0的值,将在面与面交接处产生圆角,最大值不能超过最小面的一半
var chamferSegmentCount: Int { get set }
The number of line segments used to create each rounded edge of the box. Animatable.
倒角的线段数,值越大,越光滑,但是消耗的性能越多,默认值是10

相关文章

  • SCNBox

    六面多面体几何,其面均为矩形,可以选择带有圆角和圆角。 通过设置框的宽度,高度和长度属性,在其局部坐标空间的x,y...

  • IOS 学习AR(3)( 3D引擎 SceneKit SC

    SCNGeometry几何体类型 1.SCNBox 立方体 代码:(下面只介绍几何体创建) //盒子 SCNBox...

  • AR的平面检测和利用SceneKit构建几何体

    ar的检测方法是ARSCNView的代理的方法 主要代码如下: 构建几何体的主要代码如下: 利用SCNBox来创建...

网友评论

      本文标题:SCNBox

      本文链接:https://www.haomeiwen.com/subject/kcbejktx.html