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
网友评论